On Thursday, 13 February 2014 at 17:12:28 UTC, Dicebot wrote:
On Thursday, 13 February 2014 at 16:57:19 UTC, John Colvin
wrote:
Don't you mean const/immutable fields with initialisers don't
become instance fields? Or is this actually as strange as it
sounds?
Yes, it is legacy behavior (== bug) that persisted since D1
days and was addressed only recently. Until this
deprecation/transition process will end this:
struct X
{
const string value = "literal";
}
is effectively same as this:
struct X
{
enum value = "literal";
}
To be anal, it's technically the same as:
struct X
{
static const string value = "literal";
}
The immutable/const member will be made a static member, which
you can deference, or pass by reference.