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.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.
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.
If as you suggest, D language is fundamentally broken - is it
possible we can just get a plan for fixing it? To me this seems
like a huge design hole and I come back to the threads with
questions again and again and I really don't know how others
manage the use of const/immutable.
I've already given up on immutable. If I have to strip const as
well then that is a huge pain and unfortunate since the concept
seems sound and well argued in TDPL. Trying to mess with
mutable/const/immutable on mostly working code is like playing
whack a mole.