Do you want to help me fix static AA initialization?
Steven Schveighoffer
schveiguy at gmail.com
Sat Jul 22 15:22:12 UTC 2023
On 7/21/23 4:55 AM, Quirin Schroll wrote:
> On Friday, 21 July 2023 at 06:24:09 UTC, Chris Piker wrote:
>> Dumb user question: Presuming this is fixed would it allow code that
>> looked like this: `auto aa = ["one":1, "two":2];`
>> to work, or would the end result require `Hash!(string, string)` as
>> the type definition?
>
> As far as I understand, it would be the former. It’s only not in
> Steven’s examples because his `Hash` template is not in the runtime and
> of course not special-cased by the compiler. He asks for help to get
> exactly there.
>
Yes, you are correct.
The goal is not to have a `Hash` type, but to have a mechanism for the
compiler to convert a CTFE AA to a runtime AA. The Hash type is just a
demonstration that it can be done.
BTW, fun stuff, I've learned that the CTFE AA is actually implemented
using 2 CTFE arrays. So maybe... it might be also better to just replace
it with a CTFE-compatible library type. But there are other tricks that
need to be figured out (AAs have some magic properties).
-Steve
More information about the Digitalmars-d
mailing list