[OT] Re: DIP 1027---String Interpolation---Format Assessment
Steven Schveighoffer
schveiguy at gmail.com
Thu Feb 27 19:20:14 UTC 2020
On 2/27/20 1:42 PM, H. S. Teoh wrote:
> Making CTFE AAs usable at runtime is somewhat of a different beast,
> though. The main problem is that you need to be able to instantiate the
> binary representation of a runtime AA (the main hash table, and each of
> the buckets) at compile-time, and do so in a way that the compiler can
> turn into data in the data segment of the executable. Regardless of
> what the CTFE representation is, it needs an explicit transformation
> step to turn it into something the runtime code can decipher.
I think this is not too difficult. This works, and it's not much different:
static immutable rbt = new RedBlackTree!int(1,2, 3, 4);
In other words, I have pretty much faith that if the AA becomes a
template, then whatever call is made for ["hello": 1, "world": 2] can be
callable at compile time, and generate a compatible runtime AA.
The CTFE AA can be whatever CTFE likes, just when it moves to runtime
land, it gets translated to an AA literal.
-Steve
More information about the Digitalmars-d-announce
mailing list