Keywords: How to trick the compiler?

simendsjo simendsjo at gmail.com
Tue Jan 28 04:43:58 PST 2014


On Tuesday, 28 January 2014 at 12:25:19 UTC, Namespace wrote:
> On Tuesday, 28 January 2014 at 11:22:10 UTC, Chris wrote:
>> Is there a simple way to trick the compiler (e.g. with alias), 
>> if a keyword conflicts with a function/method, e.g. as in a 
>> HTML document:
>>
>> auto docBody = document.body;
>>
>> // corresponding method (will not compile due to body being a 
>> keyword)
>>
>> @property auto body() {
>>  // simplified code
>>  return this.getElementByTagName("body");
>> }
>
> Write in with an uppercase. ;)
> Int, If, Template...

I've also seen some people append _: body_, int_ etc.


More information about the Digitalmars-d-learn mailing list