const?? When and why? This is ugly!

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Mar 9 10:03:15 PDT 2009


Steven Schveighoffer wrote:
> On Sun, 08 Mar 2009 20:51:39 -0700, Andrei Alexandrescu wrote:
> 
>> Walter Bright wrote:
>>> Steve Schveighoffer wrote:
>>>> Walter: Use invariant when you can, it's the best! User: ok, how do I
>>>> use it?
>>>> Walter: You need to cast mutable data to invariant, but it's on you to
>>>> make sure nobody changes the original mutable data.  Casting
>>>> circumvents the typesystem, so the compiler can't help you. User: :(
>>> Unfortunately, we could not come up with a typesafe scheme for going
>>> from mutable to immutable that was reasonable. The transition is up to
>>> the user to do correctly, but it isn't a terrible burden, and is simple
>>> to get right.
>> In fact, since we last discussed that, dmd technology has made enough
>> strides (particularly wrt manipulation of copies) that we can define
>> Unique!T and something a la Java's StringBuilder with ease.
>> Unfortunately current bugs in constructor implementation delay
>> definition of such artifacts.
> 
> Yes, please fix!
> 
> -Steve

Please vote up:

http://d.puremagic.com/issues/show_bug.cgi?id=2674


Andrei



More information about the Digitalmars-d mailing list