Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Mar 15 09:05:46 PDT 2012


On 3/15/12 11:02 AM, Don Clugston wrote:
> This is good, and very, very important. Do *not* make any attempt at
> compiler integration until it is *completely* ready.
>
> This includes AA literals. They need to be accepted somehow. The
> compiler will give you syntax sugar and *nothing* more.
> One possibility might be to accept a pair of array literals,
> representing keys and values.
> Possibly it should call a CTFE function to convert them into some other
> form?

Offhand, I think this rewrite should be sufficient:

[e11:e12, e21:e22]

--->

.object.associativeArrayLiteral(e11, e12, e21, e22)

Then type manipulation and template constraints can take care of the 
rest. Am I missing something?


Andrei


More information about the Digitalmars-d mailing list