const, final, scope function parameters

Bruno Medeiros brunodomedeiros+spam at com.gmail
Wed May 30 04:16:26 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.
> 
> 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.
> 
> 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.

I'm gonna repost my question in this thread:

What is the reasoning behind the idea of 'scope' being the default 
together with 'const' and 'final'? I understand (and agree) why 'final' 
and 'const' should be the default type modifiers for function 
parameters, but why 'scope' as well? Does it look like 'scope' would be 
more common than non-scope?



-- 
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list