const challenge

Derek Parnell derek at psych.ward
Sun Feb 3 02:04:04 PST 2008


On Sun, 3 Feb 2008 08:43:54 +0000, Janice Caron wrote:

> On 2/3/08, Derek Parnell <derek at psych.ward> wrote:
>> As far as I can recall, D has always said that
>> concatenation creates a dynamic array, and since 'const' has been in use,
>> that array is also a mutable one.
> 
> I don't think that's true. Back in November, Steven Schveighoffer
> wrote this post:
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=61276
> 
> Stephen was finding he needed to explicitly .dup to get a mutable result.

With respect and meaning no offense, however even though that post of Steven's says...

>> auto a2 = a1 ~ "\n";
>> Now, a2 is declared as a const(char)[] array,
 
He has not shown any evidence that that is actually the case. It could
be that he is assuming that to be the case, because each attempt I have
made to duplicate his assertion has just shown me that the compiler
regards 'a2' as mutable.

The current D2 compiler treats 'a2' as mutable.

-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell



More information about the Digitalmars-d mailing list