cannot initalize a struct for AA

Jonathan Marler johnnymarler at gmail.com
Sat Dec 15 02:39:51 UTC 2018


On Saturday, 15 December 2018 at 02:33:27 UTC, Neia Neutuladh 
wrote:
> On Sat, 15 Dec 2018 02:22:51 +0000, Michelle Long wrote:
>> [...]
>
> AA[key] is not a variable initialization. Struct initializer 
> literals are only valid at variable initialization. I think a 
> few people (at least one, which is to say, me) have looked at 
> adding a way to make them work at arbitrary locations. One 
> thing that makes that not so easy is that the syntax doesn't 
> include the type, so you'd need a way to explicitly specify it. 
> For example:
>
> [...]

I have hopes that one day we'll have support for something like 
`Foo{i:10}`.


More information about the Digitalmars-d mailing list