Nested associative arrays

spir denis.spir at gmail.com
Sat Nov 13 12:02:39 PST 2010


On Sat, 13 Nov 2010 17:27:08 +0000
div0 <div0 at sourceforge.net> wrote:

> > How about "associative array literal" then? Regardless of what you call
> > it I shouldn't get an assertion failure.
> >  
> 
> True. It's been fixed in dmd2 though, you get:
> 
> Error: Integer constant expression expected instead of ""
> 
> When it's auto the compiler thinks you are doing static initialisation 
> of a flat array, not an AA. You have to do what Ellery said.

But the compiler (D2) accepts nested aa literals remaining anonymous:
    writeln(["a" : ["b" : "c"]]);	// --> "a:b:c"
(where "auto aa = ..." fails)

Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d-learn mailing list