immutable and static this()

2011-03-21 Thread teo
I cannot initialize immutable class members inside a static this() constructor. Is there any reason for that? Example: class Test { public immutable(int) x; static this() { x = 1; // Error: variable Test.x can only initialize const x inside constructor } }

Re: immutable and static this()

2011-03-21 Thread Simen kjaeraas
On Mon, 21 Mar 2011 22:27:17 +0100, teo teo.ubu...@yahoo.com wrote: I cannot initialize immutable class members inside a static this() constructor. Is there any reason for that? Example: class Test { public immutable(int) x; static this() { x = 1; // Error: variable Test.x

Re: immutable and static this()

2011-03-21 Thread Jonathan M Davis
On Mon, 21 Mar 2011 22:27:17 +0100, teo teo.ubu...@yahoo.com wrote: I cannot initialize immutable class members inside a static this() constructor. Is there any reason for that? Example: class Test { public immutable(int) x; static this() { x = 1

Re: immutable and static this()

2011-03-21 Thread teo
On Mon, 21 Mar 2011 22:27:53 +0100, Simen kjaeraas wrote: On Mon, 21 Mar 2011 22:27:17 +0100, teo teo.ubu...@yahoo.com wrote: I cannot initialize immutable class members inside a static this() constructor. Is there any reason for that? Example: class Test { public immutable(int) x