> 
> I feel that member functions for access control is one of the many ways in
> which the concept of 'the object' has been conflated.  It is simple, but
it
> doesn't compose, and sometimes it really needs to, where you find yourself
> in a situation where the function needs to be a member (for purposes of
> access) of more than one object.  Typically people seem to hack around
such
> things by making more things public or package access.

But don't type classes w  "member methods"  specifically allow this case ?
Though we have discussed this may be confusing.
> 
> And yet, it *does* compose better than init-only fields.  These divide the
> world of code into the constructor, where 'this' is not properly an
instance of
> the class, and other code, which must not initialise these fields.  In
reality, the
> object may go through several states where subsequent attributes are
> effectively immutable; but the only way to represent this within the type
> system is to construct a new instance of a similar class, with the
appropriate
> attributes made final.
> 
> 
> Alternatively, the concept of access could can be made more first-class,
> which seems neater to me, but I don't know if there is any active research
in
> that area (Friends of C++ have probably scared anybody who would do such
> research away).

I must admit I'm a bit biased  since I find member functions  ( especially
inline) result in neat code and they don't expose much  ( especially if you
also allow private/internal ) resulting in many little but significant
benefits ( simpler auto complete  ,  cleaner namespaces , easier to read/
understand code , better security   etc  )   ie Syntactic sugar with
benefits .  To me with  ignorance it seems well know and simpler than  the
other methods suggested   and im quite ignorant of  region analysis /
uniqueness types !  It can also help  simplify deep immutability eg sub
objects passed in or created during the constructor of the parent. 
 That said Shap said there were some nasty issues in implementing "this" ,
with the type system from the caller which I cant quite remember.

I do find it interesting how the same things seems to interrelate and when
pushed the same things pop out when looked at from different ways   ( member
functions , mutability / deep mutability , n > 1 type classes , regions  ,
constructors  and methods vs type classes etc ) ..  which means something
and I don't think its entirely my own preoccupations ..

Ben

_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to