const, final, scope function parameters

Dave Dave_member at pathlink.com
Sun May 27 07:11:28 PDT 2007


Walter Bright wrote:
> It looks like making "const final scope" be the default for function 
> parameters is going to be infeasible. The troubles are that:
> 
> 1) It seems to knock a lot of people for a loop, who will be assuming 
> that an undecorated name would be like an undecorated name for a local 
> or global variable.
> 

I can understand that concern, but who've you been bouncing the beta off of ("It seems to knock 
people for a loop")?

It seems that over in d.D.announce the response was the opposite (IIRC, most were in favor of 'in' 
by default, at least to try with 2.0 to start off with).

That said, I have a nagging suspicion you'd be right for the most likely people to try D.

> 2) Having to turn off one of the const, final, or scope, introduces the 
> need for some sort of "not" keyword, like mutable, !const, !final, etc. 
> It comes off looking bizarre.
> 

Already suggested, but maybe consider making the 'in' mean what it does in 1.x, undecorated as 
'final const scope', and any other specifier(s) overrides any default group (const would be just 
const, etc.)?

> However, making "in" be equivalent to "const final scope" does seem to 
> work fine, requires no new keywords, and doesn't seem to confuse anyone.
> 
> On a related note, "cstring" has received universal condemnation <g>, so 
>   I'll just have to make "string" work.



More information about the Digitalmars-d mailing list