On Sun, Mar 04, 2012 at 03:24:47PM +1100, Daniel Murphy wrote: > "Andrei Alexandrescu" <[email protected]> wrote in message > news:[email protected]... [...] > > I think we must migrate the arrays into the runtime. > > > > Andrei > > I know. It was before my time, but I assume you were the one who > pushed for this in the first place? > > The one advantage I can see to having them in druntime gives is that > it means they can be fully templated, and therefore do comparisons etc > without going through typeinfo. This is it right? [...]
Not just comparisons, but size of values, etc., all need typeinfo currently. Pretty much all the code in aaA.d needs to dig under the hood and do lots of black magic like pointer arithmetic based on typeinfo stuff in order to do stuff. Perhaps _aaLen might be the only exception. While it's cool that D lets you do this when needed, it's also a sign that some cleanup might be in order. :-) How feasible is it to migrate AA's into object_.d, say, and have the stuff in aaA.d simply wrap around AssociativeArray? I suppose this can't really happen without some major changes in the compiler, since I don't know how to instantiate AssociativeArray given only the typeinfo's (not the actual types) of the key/value. T -- It won't be covered in the book. The source code has to be useful for something, after all. -- Larry Wall
