Do you want to help me fix static AA initialization?

Chris Piker chris at hoopjump.com
Fri Jul 21 06:24:09 UTC 2023


On Thursday, 29 June 2023 at 19:48:40 UTC, Steven Schveighoffer 
wrote:
> I have a fix for static associative array initialization.

Cool!

> This allows static initialization of AAs, e.g.:
>
> ```d
>
> Hash!(string, string) ctaa = [
>    "name" : "Steve",
>    "username" : "schveiguy"
> ];
>
> void main()
> {
>    string[string] aa = ctaa.asAA;
> }
>
> ```

Dumb user question:  Presuming this is fixed would it allow code 
that looked like this:
```d
import std.stdio: writeln;

auto aa = ["one":1, "two":2];

void main(){
     writeln(aa["one"]);
}
```
to work, or would the end result require `Hash!(string, string)` 
as the type definition?





More information about the Digitalmars-d mailing list