[Issue 7318] Cannot concatenate arrays of super- and subtype
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jan 20 07:43:30 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7318
--- Comment #6 from Andrei Alexandrescu <andrei at metalanguage.com> 2012-01-20 07:43:29 PST ---
> I could use a template to do the job:
>
> ref A[] append(A,B)(ref A[] x, B[] y) if(is(B:A)) {
> foreach(e; y){
> x.length++;
> x[$-1] = e;
> }
> return x;
> }
>
> (it is more general than built-in append, but that could be fixed with a better
> constraint)
This suggests that the compiler should simply translate e1 ~= e2 into
.object.append(e1, e2) and let druntime take care of the rest. One up for
moving decisions from the compiler to the runtime.
In case of compile-time operation, the compiler should continue doing what it
now does.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list