const, final, scope function parameters

Lars Ivar Igesund larsivar at igesund.net
Sun May 27 00:40:56 PDT 2007


Chris Nicholson-Sauls wrote:

> 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.
> 
> I like the 'in' method myself.
> 
>> On a related note, "cstring" has received universal condemnation <g>, so
>>   I'll just have to make "string" work.
> 
> Or maybe something like:
> alias const( char)[] utf8  ; // or even u8string
> alias const(wchar)[] utf16 ; // or even u16string
> alias const(dchar)[] utf32 ; // or even u32string
> 
> -- Chris Nicholson-Sauls

Hear hear :)

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango



More information about the Digitalmars-d mailing list