Associative arrays

Adam D. Ruppe destructionator at gmail.com
Tue May 18 11:54:45 UTC 2021


On Tuesday, 18 May 2021 at 09:41:06 UTC, Ola Fosheim Grostad 
wrote:
> It  could look the same, but long[string] would now be a 
> shorthand for std.xyz.Map!(long,string) or something like that 
> instead of a special case.

It would actually be really cool if the AA literal was just 
rewritten into a constructor call of key, value, key, value, ....


_d_aa_literal(T...)(T args) // pragma(discardable) too would be 
nice

[4: "hello", 6: "bye"]

_d_aa_literal(4, "hello", 6, "bye")


Then you can construct it at ctfe and it retains the order and 
the capability of heterogeneous types. It'd be overpowered to an 
awesome extent... and would fix that annoying static 
initialization of AA things.


More information about the Digitalmars-d mailing list