fieldPostBlit - what is wrong with this and workarounds

Maxim Fomin maxim at maxim-fomin.ru
Thu Oct 31 08:56:43 PDT 2013


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 using a const object
>
> Is this fundamentally incorrect? I abandoned immutable in hopes 
> that const would be more manageable and so far it has. But 
> these types of issues still crop up and stop me in my tracks.
>
> What are the requirements on RateCurve and T for this to work?
>
> Thanks
> Dan

D language is fundamentally incorrect here. There are sufficient 
issues in bugzilla (one which bearophile provided is actually 
relevant, it shows same problem from a little bit different 
aspect) and the problem tends to pop up quire regularly. It looks 
like nothing is done because it is design issue and although 
there were attempts to come up with, no idea is viewed as final 
solution. The easiest way to solve problem is to strip const.


More information about the Digitalmars-d-learn mailing list