------- Comment #5 from  2009-02-19 03:41 -------
(In reply to comment #4)
> (In reply to comment #3)
>> It reallocated array on increasing length. Seems valid.

What did - the testcase here with checking added, the testcase at bug 2093 or
your own?  With which DMD version?

> Problem is that sort and reverse work in-place, thus modifying immutable
> variable. It should either not compile /or/ allocate a copy. I don't like the
> hidden allocations, so this should be just disallowed, imo.

Indeed, to either modify in-place or reallocate depending on constancy status
would be a confusing inconsistency.  They should be distinct operations. 
Indeed, you can already do a reallocating sort or reverse by doing

    int[] sorted = x.dup.sort;
    invariant(int)[] = assumeUnique(x.dup.reverse);

so it would be a question of whether it's worth creating syntactic sugar for


Reply via email to