Voldemort declarations inside structs with ctor initialization

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Tue May 27 08:06:52 PDT 2014


Luís Marques:

> If the language allowed foo to be declared using auto (which 
> would be deduced from the assignment in the ctor), that would 
> be nice, right?

This is a kind of flow typing, it's rather useful but it 
introduces several complexities, so I think it's now too much 
late to add it to D.


> BTW, why doesn't this example work with lambdas (a => a != 2) 
> instead of a string mixin ("a != 2")?

I think lambda instantiations defines a different type. So it's 
incompatible.


> BTW 2, is `this(int = 0)' the best workaround (still?)

I think it's not a good workaround.

Bye,
bearophile


More information about the Digitalmars-d mailing list