allMembers broke for __

Steven Schveighoffer schveiguy at yahoo.com
Mon Jun 18 17:07:42 UTC 2018


On 6/18/18 12:57 PM, bauss wrote:
> On Monday, 18 June 2018 at 08:25:46 UTC, Russel Winder wrote:
>> On Sun, 2018-06-17 at 15:55 -0700, Walter Bright via Digitalmars-d wrote:
>>>
>> […]
>>> Identifiers starting with __ are reserved for the implementation:
>>>
>>>    https://dlang.org/spec/lex.html#identifiers
>>>
>>> They have implementation-defined behavior. Do not use them in user code.
>>
>> In delegates I have found I have to use _ and __ (and ___, ____, 
>> etc.,but I have only had to use two to date) for delegate parameters 
>> that are to be unused and unnamed. Are these treated differently 
>> because they are all underscores?

You can just not give them names.

> Well you can use identifiers that uses __, but certain names that uses 
> __ as a prefix will have implementation defined behavior.
> 
> I guess for parameters that are strictly __ etc. they're just behaving 
> "normal" because there are no implementation behavior for said 
> identifiers and thus defaults to "normal behavior".
> 
> I also guess it's mostly an issue with function names, field names etc. 
> and not really paramters, but I could be wrong.

For names that won't be used, it doesn't matter what the name is. In 
some languages, the single underscore symbol is reserved for names that 
won't be used. So when porting to D, perhaps there is the case where you 
might feel they need other non-standard names.

However, in this case, D does not require names, so it's a moot point.

-Steve


More information about the Digitalmars-d mailing list