pure vs immutable

2015-11-19 Thread Jack Applegame via Digitalmars-d-learn
I believe that object constructed with pure constructor should be implicitly convertible to immutable. It is, but only for default constructor. class Foo { string s; this() pure { s = "fpp"; } this(string p) pure { s = p; } } void main() { auto foo1 = new immutable

Re: pure vs immutable

2015-11-19 Thread Jack Applegame via Digitalmars-d-learn
Heh immutable Foo foo2 = new Foo("bar"); // compiles