allMembers broke for __

angel andrey.gelman at gmail.com
Sun Jun 17 09:29:37 UTC 2018


On Sunday, 17 June 2018 at 02:25:59 UTC, Adam D. Ruppe wrote:
> On Sunday, 17 June 2018 at 01:02:17 UTC, DigitalDesigns wrote:
>> If this was a sane language constraint then any identifiers 
>> starting with __ that were not reserved would at least give a 
>> warning but particularly give an error! Not fail silently and 
>> break code in ways that cannot be determined otherwise.
>
> It is undefined behavior to use ANY identifier with __ leading. 
> C works exactly the same way.

I'm sure there are naive C programmers who use "__" prefix for 
their own purposes.

Maybe it would be cleaner to create more special syntax for 
"internal" functions/methods, e.g require some kind of UDA in 
addition to the "__" prefix:

@Dinternal
void __someMethod() ...

Then disallow "__" prefix altogether (with the exception above).

Now, if someone still uses both the UDA and the prefix, he really 
cannot say he didn't know.



More information about the Digitalmars-d mailing list