const(FAQ)

Derek Parnell derek at psych.ward
Sat Mar 29 18:08:51 PDT 2008


On Sun, 30 Mar 2008 02:42:25 +0200, serg kovrov wrote:

> Unknown W. Brackets wrote:
>> Question:
>> 
>> In my limited use of const thus far, I've found that "ignoring" or "just 
>> not using" it is not as possible as suggested.  This is because the 
>> standard library imposes it.

Yes it does, but that hasn't been a problem. In fact, it has been a problem
in those few times that phobos doesn't use string.

> I always fall back to D1 after coule of hours figuring what 
> I have to do (cast/dup to and when) to achieve the task at hand.

This *is* wierd. I'm using D2 as my version-of-choice an I almost never
have to cast or dup. In fact, I haven't needed to cast at all and the only
dups I need are when I'm returing a slice to a caller who is going to later
manipulate the data in the slice. Even then, it guess I should still return
an invariant and get the caller to do the dup if they need to. But the D2
const system is not impeding me at all ... well I did have to work around
the absence of tail-const once.

-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell



More information about the Digitalmars-d mailing list