Do you want to help me fix static AA initialization?

Steven Schveighoffer schveiguy at gmail.com
Mon Jul 3 15:48:05 UTC 2023


On 7/3/23 10:18 AM, Stefan Koch wrote:
> On Thursday, 29 June 2023 at 19:48:40 UTC, Steven Schveighoffer wrote:
>> Hi everyone,
>>
>> I have a fix for static associative array initialization. Basically, I 
>> have a project called `newaa` which is a library-based copy of D's 
>> associative arrays. The url is here: https://github.com/schveiguy/newaa
>>
>> [...]
> 
> I have copied the druntime implementation of AAs into the dmd compiler 
> and allowed it to build static array literals.
> It needs some work to make it really generic but it would be something 
> to look at:
> https://github.com/dlang/dmd/compare/master...UplinkCoder:dmd:aaConstantLiteral

Thanks for the link, but I think this is the wrong approach. The 
compiler shouldn't have a separate identical implementation internally, 
that means we have to maintain 2 identical implementations, and more 
unspoken dependencies from compiler to library (someone could make a 
minor change in the library version and forget to update the compiler, 
resulting in odd behaviors or crashes). What we need is a library 
implementation that can do this work during CTFE.

However, I appreciate the link, because maybe I can actually figure out 
where to properly add the right calls.

-Steve


More information about the Digitalmars-d mailing list