Re: fieldPostBlit - what is wrong with this and workarounds

2013-11-06 Thread Daniel Davidson
On Friday, 1 November 2013 at 20:29:54 UTC, Jonathan M Davis wrote: On Friday, November 01, 2013 14:28:55 Daniel Davidson wrote: On Thursday, 31 October 2013 at 19:39:44 UTC, Jonathan M Davis Deep copying is not the only reason to have a postblit. Smart pointers such as std.typecons.RefCounte

Re: fieldPostBlit - what is wrong with this and workarounds

2013-11-01 Thread Jonathan M Davis
On Friday, November 01, 2013 14:28:55 Daniel Davidson wrote: > On Thursday, 31 October 2013 at 19:39:44 UTC, Jonathan M Davis > > wrote: > > const and postblit fundamentally don't mix, because for it to > > work, you have > > to violate the type system. With postblits, the struct gets > > memcpied

Re: fieldPostBlit - what is wrong with this and workarounds

2013-11-01 Thread Daniel Davidson
On Thursday, 31 October 2013 at 19:39:44 UTC, Jonathan M Davis wrote: const and postblit fundamentally don't mix, because for it to work, you have to violate the type system. With postblits, the struct gets memcpied and then the postblit constructor has the chance to mutate the resulting object

Re: fieldPostBlit - what is wrong with this and workarounds

2013-10-31 Thread Jonathan M Davis
On Thursday, October 31, 2013 15:03:26 Daniel Davidson wrote: > Given this code: > > import plus.tvm.rate_curve; > struct T { > RateCurve m; > } > struct S { > const(T) rc; > } > > I get this error: Error: mutable method > plus.models.dossier.__unittestL42_1.T.__fieldPostBlit is not > callable us

Re: fieldPostBlit - what is wrong with this and workarounds

2013-10-31 Thread Maxim Fomin
On Thursday, 31 October 2013 at 17:22:07 UTC, Daniel Davidson wrote: I'm think you may be correct... but what specifically is incorrect about the language? When I see __fieldPostBlit I get the feeling it is more an implementation issue than the language. __postblit also looks like implementa

Re: fieldPostBlit - what is wrong with this and workarounds

2013-10-31 Thread Daniel Davidson
On Thursday, 31 October 2013 at 15:56:45 UTC, Maxim Fomin wrote: On Thursday, 31 October 2013 at 14:03:28 UTC, Daniel Davidson wrote: Given this code: import plus.tvm.rate_curve; struct T { RateCurve m; } struct S { const(T) rc; } I get this error: Error: mutable method plus.models

Re: fieldPostBlit - what is wrong with this and workarounds

2013-10-31 Thread Maxim Fomin
On Thursday, 31 October 2013 at 14:03:28 UTC, Daniel Davidson wrote: Given this code: import plus.tvm.rate_curve; struct T { RateCurve m; } struct S { const(T) rc; } I get this error: Error: mutable method plus.models.dossier.__unittestL42_1.T.__fieldPostBlit is not callable

Re: fieldPostBlit - what is wrong with this and workarounds

2013-10-31 Thread Daniel Davidson
On Thursday, 31 October 2013 at 14:28:31 UTC, bearophile wrote: Daniel Davidson: I get this error: Error: mutable method plus.models.dossier.__unittestL42_1.T.__fieldPostBlit is not callable using a const object Related: http://d.puremagic.com/issues/show_bug.cgi?id=4867 Bye, bearophile T

Re: fieldPostBlit - what is wrong with this and workarounds

2013-10-31 Thread bearophile
Daniel Davidson: I get this error: Error: mutable method plus.models.dossier.__unittestL42_1.T.__fieldPostBlit is not callable using a const object Related: http://d.puremagic.com/issues/show_bug.cgi?id=4867 Bye, bearophile

fieldPostBlit - what is wrong with this and workarounds

2013-10-31 Thread Daniel Davidson
Given this code: import plus.tvm.rate_curve; struct T { RateCurve m; } struct S { const(T) rc; } I get this error: Error: mutable method plus.models.dossier.__unittestL42_1.T.__fieldPostBlit is not callable using a const object Is this fundamentally incorrect? I abandoned i