Jump to page: 1 2 3
Thread overview
Keywords: How to trick the compiler?
Jan 28, 2014
Chris
Jan 28, 2014
Stanislav Blinov
Jan 28, 2014
Chris
Jan 28, 2014
Stanislav Blinov
Jan 28, 2014
Namespace
Jan 28, 2014
simendsjo
Jan 28, 2014
Dicebot
Jan 28, 2014
Chris
Jan 28, 2014
Andrej Mitrovic
Jan 28, 2014
Stanislav Blinov
Jan 28, 2014
Ary Borenszweig
Jan 28, 2014
bearophile
Jan 28, 2014
Ary Borenszweig
Jan 28, 2014
Chris
Jan 29, 2014
Ary Borenszweig
Jan 29, 2014
Stanislav Blinov
Jan 30, 2014
Chris
Jan 30, 2014
Stanislav Blinov
Jan 28, 2014
Martin Cejp
Jan 28, 2014
Stanislav Blinov
Feb 01, 2014
Marc Schütz
Jan 28, 2014
Casper Færgemand
Jan 28, 2014
Chris
Jan 28, 2014
Piotrek
Jan 28, 2014
Adam D. Ruppe
January 28, 2014
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");
}
January 28, 2014
On Tuesday, 28 January 2014 at 11:22:10 UTC, Chris wrote:

Nope, just choose a different name.
January 28, 2014
On Tuesday, 28 January 2014 at 11:24:33 UTC, Stanislav Blinov wrote:
> On Tuesday, 28 January 2014 at 11:22:10 UTC, Chris wrote:
>
> Nope, just choose a different name.

Cripes! There goes my API ...

January 28, 2014
On Tuesday, 28 January 2014 at 11:38:16 UTC, Chris wrote:
> On Tuesday, 28 January 2014 at 11:24:33 UTC, Stanislav Blinov wrote:
>> On Tuesday, 28 January 2014 at 11:22:10 UTC, Chris wrote:
>>
>> Nope, just choose a different name.
>
> Cripes! There goes my API ...

Aww, a bit of underscoring hasn't hurt anyone yet. :)
January 28, 2014
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...
January 28, 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.
January 28, 2014
On Tuesday, 28 January 2014 at 12:43:59 UTC, simendsjo wrote:
> I've also seen some people append _: body_, int_ etc.

It is what current Phobos style guide suggests.
January 28, 2014
On Tuesday, 28 January 2014 at 12:45:37 UTC, Dicebot wrote:
> On Tuesday, 28 January 2014 at 12:43:59 UTC, simendsjo wrote:
>> I've also seen some people append _: body_, int_ etc.
>
> It is what current Phobos style guide suggests.

Yes, I've used it, but don't like it. Maybe I'll opt for the uppercase solution.
January 28, 2014
On 1/28/14, Chris <wendlec@tcd.ie> 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;

"body" is probably the most frequent issue I run into when porting C/C++ code to D.

I really wonder whether the rule could be relaxed a little bit.
January 28, 2014
On Tuesday, 28 January 2014 at 12:57:02 UTC, Andrej Mitrovic wrote:

> "body" is probably the most frequent issue I run into when porting
> C/C++ code to D.
>
> I really wonder whether the rule could be relaxed a little bit.

o_O How?
« First   ‹ Prev
1 2 3