On 14/11/2010 00:28, Ellery Newcomer wrote:


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).

OIC, ty.

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

Yeah I know. :( I've been working on implementing some missing CTFE functionality so that one day I might actually get to upgrade from 2.028, and having dealing with initializers vs expressions is a real pita.

--
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk

Reply via email to