allMembers broke for __
DigitalDesigns
DigitalDesigns at gmail.com
Sun Jun 17 23:19:10 UTC 2018
On Sunday, 17 June 2018 at 22:55:57 UTC, Walter Bright wrote:
> On 6/15/2018 11:08 PM, DigitalDesigns wrote:
>> When an identifier starts with __, allMembers does not return
>> it. This is very bad behavior! It can silently create huge
>> problems if the programmer is not aware of the bug.
>
>
> It's not a bug, it's quite deliberate:
>
>
> https://github.com/dlang/dmd/blob/master/src/dmd/traits.d#L1385
>
>
> 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.
If you don't want me to use it then why not give an error instead
of punishing me by introducing very difficult bugs to detect?
Do you really think that everyone that starts using D will
automatically know the traps of __ and avoid it like the plague
just because you said so(even though they probably never actually
seen you say it)?
How about instead of __, you guys use ____ in your code? That
would be more sane than breaking my code because I used an extra
_.
Again, you can justify all you want... it doesn't make it right.
More information about the Digitalmars-d
mailing list