On 11/13/2010 02:02 PM, spir wrote:
On Sat, 13 Nov 2010 17:27:08 +0000

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


The difference is initializer vs expression.
initializers occur on the rhs of a decl/assignment, and they are not parsed the same as expressions (e.g. you can have 'void' and struct literals as initializers -

int i = void;
X x = {a: {b: 1}, c: "hi"};

- you can't have these in expressions).

Initializers are also stored and treated differently in the compiler, which results in this and other inconsistencies

Reply via email to