Static associative array expressions

Stefan Koch uplink.coder at googlemail.com
Sun Sep 19 13:38:57 UTC 2021


On Sunday, 19 September 2021 at 11:55:04 UTC, Steven 
Schveighoffer wrote:
> On 9/19/21 1:43 AM, Stefan Koch wrote:
>
>> What do you guys think?
>
> I think an easier fix is just to change the call that does the 
> AA literals to something that can be CTFEd. Right now it's an 
> extern(C) hook that is opaque and takes void[] and TypeInfos.
>
> Something like:
>
> ```d
> V[K] __aALiteral(V, K)(K[] keys, V[] values);
> ```
>
> Then just lower the call to that, and if that is CTFEable, it 
> works.
>
> -Steve

That puts actually more pressure on CTFE to be able to adapt to 
different layouts.
The current fixed layout of the AA allows something like newCTFE 
to do less work.
Also it introduces yet more templates, I cannot cache templates 
as effectively as I can runtime which I only have to generate 
once.


More information about the Digitalmars-d mailing list