How to break const

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Jun 18 09:42:08 PDT 2012


On 6/18/12 10:24 AM, Mehrdad wrote:
> On Monday, 18 June 2012 at 15:21:36 UTC, Timon Gehr wrote:
>>> So (**IMHO**) if that's really the case, we should really spend some
>>> time fixing the /design/ of const before the implementation...
>>
>> This is mostly about the design of object initialisation.
>>
>>> good idea or no?
>>
>> Certainly.
>
>
> My initial instinct would be to require a "const constructor" in order
> for an object to be const-able, but I'm not sure if that would work
> correctly or not..

The constructor of a const or immutable object progressively evolves the 
object from a raw state to a fixed, constructed state. During the 
process the object has not discernable type. This is what needs to be fixed.

Andrei


More information about the Digitalmars-d mailing list