preparing for const, final, and invariant
Derek Parnell
derek at nomail.afraid.org
Sun May 20 17:03:18 PDT 2007
On Sun, 20 May 2007 14:53:54 -0400, Regan Heath wrote:
> Walter Bright Wrote:
>> Do not use 'in' if you wish to do any of these operations on a
>> parameter. Using 'in' has no useful effect on D 1.0 code, so it'll be
>> backwards compatible.
>>
>> Adding in all those 'in's is tedious, as I'm finding out :-(, but I
>> think the results will be worth the effort.
...
> Why not make this implicit 'in' parameter 'scope const final' avoiding
> the need to explicity say 'in' everywhere?
>
> My reasoning is that I think 'scope const final' should be the default
> for parameters as it's the most commonly used and safest option for
> parameters. People should use it by default/accident and should have
> to explicitly opt out in cases where it makes sense. These cases
> would then be clearly, visibly marked with 'out', 'ref' etc
Thanks Regan, your proposal sits very comfortably with me.
I have no problems with adding the 'ref' (whatever) keyword in those cases
where an implicit 'in' (a.k.a. 'scope const final') causes the compiler to
complain.
--
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Justice for David Hicks!"
21/05/2007 9:59:51 AM
More information about the Digitalmars-d-announce
mailing list