How do I create a module-local immutable class object?

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Sep 9 14:45:23 PDT 2011


So much for that idea, immutable breaks property functions. Take a look:

class Foo
{
    this()
    {
        value = true;
    }

    @property bool value() { return true; }
    @property void value(bool value) { }
}

void main()
{
    auto foo1 = new Foo;
    auto val1 = foo1.value;

    auto foo2 = new immutable(Foo);
    auto val2 = foo2.value;  // fail
}

Is this a known issue or should I file it?


More information about the Digitalmars-d-learn mailing list