Go and generic programming on reddit, also touches on D
Steven Schveighoffer
schveiguy at yahoo.com
Mon Sep 19 04:25:31 PDT 2011
On Sun, 18 Sep 2011 15:34:16 -0400, Timon Gehr <timon.gehr at gmx.ch> wrote:
> On 09/18/2011 08:28 PM, Andrei Alexandrescu wrote:
>> That would allow us to e.g. switch from the
>> pointer+length representation to the arguably better pointer+pointer
>> representation with ease.
>
> In what way is that representation better?
I agree, I don't see why the representation is inherently better. Some
operations become higher performance (i.e. popFront), and some become
worse (i.e. length). Most of the others are a wash.
FWIW, you can avoid bloat by converting to runtime calls when templating
is not necessary. For example, append could just be a template shell:
opBinary(string op : "~=")(T other)
{
return _d_appendTi(...) // don't remember the parameter types/order
}
In any case, before this could happen, we'd need to implement UFCS for
custom types, and we'd need a solution on how to specify const(T)[] using
a template (that implicitly casts from T[]).
-Steve
More information about the Digitalmars-d
mailing list