Re: Can't assign to static array in ctor?

2012-04-10 Thread bearophile
Andrei Alexandrescu: I'll note that fixing this bug is more difficult than it might seem, particularly when immutable members and immutable constructors come into play. Some flow control is needed. At start each member variable of the object starts in a raw state. The constructor code

Re: Can't assign to static array in ctor?

2012-04-10 Thread Andrei Alexandrescu
On 4/10/12 4:04 AM, bearophile wrote: Andrei Alexandrescu: I'll note that fixing this bug is more difficult than it might seem, particularly when immutable members and immutable constructors come into play. Some flow control is needed. At start each member variable of the object starts in a

Re: Can't assign to static array in ctor?

2012-04-10 Thread bearophile
Andrei Alexandrescu: That reminds me of this approach to implement non-nullables: http://research.microsoft.com/pubs/67461/non-null.pdf Yes, that's our source of inspiration for cooked/raw. So maybe it's possible to re-use the same compiler logic (routines) to support built-in

Can't assign to static array in ctor?

2012-04-09 Thread H. S. Teoh
What's the reason the following code doesn't compile? struct S { const(int)[4] data; this(const(int)[4] d) { data = d; // this is line 4 } } void main() { S s; }

Re: Can't assign to static array in ctor?

2012-04-09 Thread bearophile
H. S. Teoh: struct S { const(int)[4] data; this(const(int)[4] d) { data = d; // this is line 4 } } void main() { S s; } I think this used to work (do you have an

Re: Can't assign to static array in ctor?

2012-04-09 Thread H. S. Teoh
On Mon, Apr 09, 2012 at 09:42:25PM +0200, bearophile wrote: H. S. Teoh: struct S { const(int)[4] data; this(const(int)[4] d) { data = d; // this is line 4 } } void main() { S s; } I

Re: Can't assign to static array in ctor?

2012-04-09 Thread kenji hara
2012年4月10日10:53 H. S. Teoh hst...@quickfur.ath.cx: On Mon, Apr 09, 2012 at 09:42:25PM +0200, bearophile wrote: H. S. Teoh: struct S { const(int)[4] data; this(const(int)[4] d) { data = d; // this is line 4 } }

Re: Can't assign to static array in ctor?

2012-04-09 Thread Daniel Murphy
H. S. Teoh hst...@quickfur.ath.cx wrote in message news:mailman.1550.1333997204.4860.digitalmar...@puremagic.com... What's the reason the following code doesn't compile? struct S { const(int)[4] data; this(const(int)[4] d) { data = d; // this is line 4 } } void main() { S s; }

Re: Can't assign to static array in ctor?

2012-04-09 Thread Andrei Alexandrescu
On 4/9/12 9:03 PM, kenji hara wrote: It is a bug yet not fixed. http://d.puremagic.com/issues/show_bug.cgi?id=6174 I'll note that fixing this bug is more difficult than it might seem, particularly when immutable members and immutable constructors come into play. Some flow control is needed. At

Re: Can't assign to static array in ctor?

2012-04-09 Thread H. S. Teoh
On Mon, Apr 09, 2012 at 06:53:32PM -0700, H. S. Teoh wrote: On Mon, Apr 09, 2012 at 09:42:25PM +0200, bearophile wrote: H. S. Teoh: struct S { const(int)[4] data; this(const(int)[4] d) { data = d; // this is line 4 }

Re: Can't assign to static array in ctor?

2012-04-09 Thread kenji hara
2012年4月10日11:22 Andrei Alexandrescu seewebsiteforem...@erdani.org: On 4/9/12 9:03 PM, kenji hara wrote: It is a bug yet not fixed. http://d.puremagic.com/issues/show_bug.cgi?id=6174 I'll note that fixing this bug is more difficult than it might seem, particularly when immutable members and