I will bite . Isnt this another reason why we should have member inline
functions and constructors for structs to create quasi classes ( maybe if
keyword class must  have a constructor) ? Not for polymorphism but the
encapsulation helps  eg if the type is not accessible till the constructor
is finished then all or some  fields and the type itself may be immutable
and its trivial to guarantee this.. even for stack / static data... I think.


 

Also member functions are also useful here as I have often found it useful
to know that an object cant be modified externally  ( not publicly mutable
?)  allowing simpler locking etc .

 

Ben

 


The problem is that even when it is subject to lifetime safety, and even
when we consider only the single-threaded case, an init-only field is not
immutable.In order for the output of length() to be stable it needs to be
immutable.

If this is making your brain hurt, you're in very good company. Speaking for
myself, I definitely feel like I need to sleep on this.


shap

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

Reply via email to