DMD 2.000 alpha release

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Mon Jun 18 09:04:15 PDT 2007


Sean Kelly wrote:
> Walter Bright wrote:
>> This is an alpha release to try out the const/final/invariant stuff.
>>
>> The current definition of string is:
>>
>>     alias const(char)[] string;
>>
>> Andrei has argued strongly to make it invariant. I think he's probably 
>> right, and that change might happen next.
> 
> Out of curiosity, is this at all meaningful?
> 
> void fn( inout string val ) {}

Sure. (assuming you fill in the {}s)
That definition of the string alias only makes the contents of the 
string const, not the reference to it. So you're free to assign the 
array reference passed in to some other string (including slices of the 
initial value).
This will still hold if the contents become invariant, by the way.



More information about the Digitalmars-d-announce mailing list