immutable, const, enum

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Apr 29 06:21:42 PDT 2009


Steven Schveighoffer wrote:
> On Wed, 29 Apr 2009 03:35:32 -0400, Walter Bright 
> <newshound1 at digitalmars.com> wrote:
> 
>> Derek Parnell wrote:
>>> Oh, I agree. It is just that the documentation is pretty adamant that
>>> "immutability" means that the data WILL NOT change. It gives the 
>>> impression
>>> that there is compiler support to ensure that this is axiomatic 
>>> rather than
>>> just a convention.
>>
>> D is a systems programming language. By that I mean that there are 
>> mechanisms to defeat the type system, for those that know what they're 
>> doing.
>>
>> If you defeat the type system, and mutate immutably-typed data, the 
>> onus is on you. It's like if you pop the carburetor off and put a 
>> supercharger on, you void the warranty <g>.
> 
> I hate having to keep argue this, but you keep forgetting.  You cannot 
> create immutable data without circumventing the type system (except 
> strings which have special treatment).

Yes, this is a bug, and one not easy to fix (requires a bit of flow 
control in constructors), but we know how to fix it. It's just a matter 
of time.

Andrei



More information about the Digitalmars-d mailing list