drepl
drepl copied to clipboard
Allow non-constant variable initializers
At module scope variable declarations only have constant initializers.
To support auto seed = unpredictableSeed()
the corresponding module should be rewritten like so.
module _mod2;
import _mod0, _mod1;
typeof(unpredictableSeed()) seed;
shared static this()
{
seed = unpredictableSeed();
}
I had some issue with this in dabble, i.e.:
input: auto a = appender!string;
re-write: typeof(appender!string) a; // error: expression (appender!string) has no type
I ended up using lambdas to deduce the type:
typeof( (()=>(appender!string))() )
Thanks, good to know. I thought that remaining property differences for typeof were already fixed, but they aren't.