Head Const
Bottled Gin via Digitalmars-d
digitalmars-d at puremagic.com
Wed Feb 17 23:38:06 PST 2016
Greetings
Having coded a multithreaded library in D, I sorely miss headcost
like specifier.
The library code dealt with lots of composite class object
hierarchy where many element objects of a parent are *effectively
immutable*. You build an effectively immutable object in the
constructor of the parent class and then you are done since you
do not assign to these object handles again. As a result there is
no need to lock the parent object while accessing an *effectively
immutable* object. The parent as well as child objects are
mutable otherwise.
Dlang's immutable and const do not provide such a contract.
So +1 for headconst if this specifier can be used with class
elements as well and not just in the function parameter list.
- Puneet
More information about the Digitalmars-d
mailing list