Static associative array expressions

Steven Schveighoffer schveiguy at gmail.com
Mon Sep 20 13:04:30 UTC 2021


On 9/20/21 8:54 AM, Stefan Koch wrote:
> On Monday, 20 September 2021 at 12:38:59 UTC, Steven Schveighoffer wrote:
>> On 9/19/21 9:38 AM, Stefan Koch wrote:

>>> 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.
>>
> 
> But that would be an interpreted/or some day JITed function call that 
> has to do the hashing of the values and place them into the right buckets.
> Which would be a different function per instance.
> 
> Whereas currently the only thing that has to be interpreted is the 
> toHash function.
> and it only has to be called once per element.

There exist ways to abstract out parts of templates that are the same 
for every instance.

What *would* have to happen is that the AA code would have to either be 
duplicated (or mostly duplicated), or made publicly accessible to the 
compiler.

-Steve


More information about the Digitalmars-d mailing list