Some Thoughts On String Interpolation [l10n, restricting access, AA]

Paul Backus snarwin at gmail.com
Sat Oct 28 13:13:16 UTC 2023


On Thursday, 26 October 2023 at 11:18:46 UTC, kdevel wrote:
> **Accessing Elements Of An AA**
>
> ```d
> string[string] aa;
> aa["name"] = "value";
> writeln (i"The name in s is $(aa[\"name\"])"
> ```
>
> That typing is laborious. Isn't there a way to bind the 
> expression to the keys of the AA?

You can do this with existing language features: 
https://run.dlang.io/is/QRFNpg

Although I wouldn't really recommend it, since it forces you to 
write fully-qualified names to access anything that *isn't* an 
associative-array key.


More information about the Digitalmars-d mailing list