On 3/15/12 12:12 PM, Steven Schveighoffer wrote:
On Thu, 15 Mar 2012 12:05:46 -0400, Andrei Alexandrescu
<seewebsiteforem...@erdani.org> wrote:

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?

Wouldn't this require a new template instantiation for each sized AA per
key/value type? Or were you planning to use varargs?

Template function takes over, does whatever is necessary, such as possibly conversion to varargs.

So long as the data that is actually passed to the AA is on the stack
(and simply a slice is passed), I like Don's idea better.

What would that look like?



Andrei

Reply via email to