[Issue 1654] Array concatenation should result in mutable or invariant depending on usage

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 28 14:47:00 PDT 2008


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





------- Comment #15 from brunodomedeiros+bugz at gmail.com  2008-05-28 16:46 -------
(In reply to comment #14)
> (In reply to comment #13)
> > "copying an invariant(int[]) to a int[]" fails indeed, but copying
> > invariant(int[]) to an invariant(int)[] would work as well.
> > So basicly what we are looking into here is tailconst. The concatenation of a
> > const(T)[] with another const(T)[] conceptually returns a type that is:
> > 
> >   tailconst(T)[]
> Not exactly.  The enhancement request has kind of mutated, due to the rule that
> I stipulated (which I think was subsequently added to D 2).
> What I think it should be is
> const(T)[] ~ const(T)[] should return a type that is T[] if const(T) implicitly
> casts to T under the rule.  If T does not implicitly cast, it should return
> const(T)[].

I understand your rule, but it is not the most permissive safe-behavior. What I
was describing was the most permissive safe-behavior possible.

For example, with your rule:
  const(int[])[] ~ const(int[])[] 
would return const(int[])[] .
But it is safe to return const(int)[][] , which is more permissive.


-- 



More information about the Digitalmars-d-bugs mailing list