Static associative array expressions
Steven Schveighoffer
schveiguy at gmail.com
Mon Sep 20 12:38:59 UTC 2021
On 9/19/21 9:38 AM, Stefan Koch wrote:
> 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.
>>
>
> That puts actually more pressure on CTFE to be able to adapt to
> different layouts.
CTFE doesn't have to use runtime AAs internally, only when moving to
code generation would it have to call this function.
> Also it introduces yet more templates, I cannot cache templates as
> effectively as I can runtime which I only have to generate once.
Only one template per AA type.
-Steve
More information about the Digitalmars-d
mailing list