immutable ctors, immutable members, and TDPL
Dicebot
m.strashun at gmail.com
Fri May 24 01:47:38 PDT 2013
Also one issue Don has brought my attention to is this snippet:
// -----------------------------
immutable int x = 1;
void main()
{
import std.stdio;
writeln(x);
}
static this()
{
x = 42;
}
// (does not compile in 2.062 and won't in 2.063)
// ------------------------------
Whatever approach is taken, I think it should be consistent with
structs/classes in a sense that global variables are module
members and module constructor is, well, constructor.
But it looks very hard to do because "immutable" is implicitly
"shared". Ideas?
More information about the Digitalmars-d
mailing list