Const by Default

Derek Parnell derek at psych.ward
Thu Jun 28 15:04:18 PDT 2007


On Thu, 28 Jun 2007 21:25:44 +0200, renoX wrote:

> Reiner Pope a écrit :
>> David B. Held Wrote:
>>> So if you look at many other areas where 'implicit X' has been
>>> tried, you see a lot of examples of bad features, some of which
>>> were actually removed.  Let's think very carefully and critically
>>> before we assume 'implicit in' is not one of them...it's only one
>>> char away from 'implicit int'. ;>
>> But what's to stop someone turning your argument completely around?
>> *Without* CbD, you can modify the variables even without asking for
>> it: the variable types are implicitly mutable. But *with* CbD, you
>> have to explicitly say, "I want this to be mutable." Doesn't this
>> make it more explicit: a good thing?
> 
> Well, if this was always true, this would be a good thing, unfortunately 
> this isn't true when there is some aliasing between a mutable parameter 
> and a const parameter..
> 
> Sure, aliasing doesn't occur often in real life, but it's still a 
> possibility that you have to take into account in your code..

What does your point have to do with whether or not 'const' is the default
action (if the coder has not said otherwise)? The aliasing issue you point
out is the same regardless of whether 'const' is the default or not. Unless
I've completely misunderstood you.

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



More information about the Digitalmars-d mailing list