"Value class instance" pattern?
Dicebot
public at dicebot.lv
Sun Jul 14 09:24:10 PDT 2013
On Sunday, 14 July 2013 at 15:17:43 UTC, bearophile wrote:
> test.d(4): Error: slice x[] is not mutable
This is almost 100% a bug. I have played a bit with this snippet
and seems like void initialization breaks usual rule that you can
cook const/immutable field in constructor (which is kind of
guaranteed by TDPL). Simple test case:
class A
{
immutable int x; // works
// immutable int x = void; // works not
this()
{
x = 42;
}
}
More information about the Digitalmars-d
mailing list