type of concatenated arrays

Steven Schveighoffer schveiguy at yahoo.com
Wed Nov 7 18:07:41 PST 2007


"Janice Caron" wrote
> Whoops!
>
> Thanks for the correction. My apologies.
>
> Well, one other possible explanation I can think of is that, if
> concatenation were to produce a mutable result then (for example)
>
>    tolower(a~b)
>
> wouldn't compile, because the argument to tolower() needs to be
> invariant. That's kind of a lame argument though.

I don't really agree with tolower being invariant, but it's not my problem 
because I don't use Phobos.  I'm building a D 2.0 compatible version of 
Tango.  Second, why should functions of the library dictate how a builtin 
language feature works?  It's supposed to be the other way around.  Third, 
my example did not involve 2 invariant arrays, one was const, the other was 
invariant.  In fact, the current result I believe is that it results in a 
const array (not sure though).

In any case, if there was another way, even if it was ugly, I'd use that, 
but I can't see how to build a non-const array without having it either copy 
the array twice (dup), or initialize all the memory before I can copy to it 
(new char[x]).

-Steve 





More information about the Digitalmars-d mailing list