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

monkyyy crazymonkyyy at gmail.com
Sat Oct 28 17:50:11 UTC 2023


On Saturday, 28 October 2023 at 13:13:16 UTC, Paul Backus wrote:
> 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.

https://run.dlang.io/is/jyNmOi
different solution


More information about the Digitalmars-d mailing list