January 28, 2014
On Tuesday, 28 January 2014 at 12:58:29 UTC, Stanislav Blinov wrote:

>> I really wonder whether the rule could be relaxed a little bit.
>
> o_O How?

If "body" never appears after a ".", and is only before a "{"  then there is no conflict?
January 28, 2014
On 1/28/14, 10:00 AM, "Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang@gmail.com>" wrote:
> On Tuesday, 28 January 2014 at 12:58:29 UTC, Stanislav Blinov wrote:
>
>>> I really wonder whether the rule could be relaxed a little bit.
>>
>> o_O How?
>
> If "body" never appears after a ".", and is only before a "{" then there
> is no conflict?

Exactly: body is only a conflict when appearing alone. But after a "." it's perfectly fine.

In Ruby you can do this:

class Foo
  def end
    1
  end
end

Foo.new.end

January 28, 2014
Ary Borenszweig:

> In Ruby you can do this:
>
> class Foo
>   def end
>     1
>   end
> end
>
> Foo.new.end

Ruby is a different language from D, they define "code safety" in quite different ways.

Bye,
bearophile
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:

alas, no. In my dom.d, I called that method "mainBody" instead...

If you are accessing a C function called body, you can access it using pragma mangle:

pragma(mangle, "body")
void cBody() { }


Still can't call it "body" in D, so have to add something, but the pragma mangle will make the name match up for the linker so it refers to the same C function.
January 28, 2014
On Tuesday, 28 January 2014 at 14:30:36 UTC, bearophile wrote:
> Ruby is a different language from D, they define "code safety" in quite different ways.

In D I think "body" actually is redundant since in/out always should be followed by a function body?

Maybe it has more to do with parsing strategies. If you use a separate and fully independent lexer then the symbol "body" might be lost and replaced by a keyword enumeration so by tradition you reserve all keywords?
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.

All my input and output streams in Java are called in and out. x.x
Reminds me of max and min in competitive programming in C++.
January 28, 2014
On Tuesday, 28 January 2014 at 16:14:48 UTC, Casper Færgemand wrote:
> 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.
>
> All my input and output streams in Java are called in and out. x.x
> Reminds me of max and min in competitive programming in C++.

Some kind of aliasing mechanism would be nice to escape keyword restrictions. It's a bit awkward to have

document.body_ or document.Body or whatnot.

But I guess it's not trivial to implement that without breaking code safety and parsing mechanisms.
January 28, 2014
On 1/28/14, 11:30 AM, bearophile wrote:
> Ary Borenszweig:
>
>> In Ruby you can do this:
>>
>> class Foo
>>   def end
>>     1
>>   end
>> end
>>
>> Foo.new.end
>
> Ruby is a different language from D, they define "code safety" in quite
> different ways.
>
> Bye,
> bearophile

Having a method named "end" doesn't make the language less safe.
January 28, 2014
On Tuesday, 28 January 2014 at 17:18:44 UTC, Ary Borenszweig wrote:
> On 1/28/14, 11:30 AM, bearophile wrote:
>> Ary Borenszweig:
>>
>>> In Ruby you can do this:
>>>
>>> class Foo
>>>  def end
>>>    1
>>>  end
>>> end
>>>
>>> Foo.new.end
>>
>> Ruby is a different language from D, they define "code safety" in quite
>> different ways.
>>
>> Bye,
>> bearophile
>
> Having a method named "end" doesn't make the language less safe.

End is cumbersome and looks awkward. Sure there are other ways ;)
January 28, 2014
On Tuesday, 28 January 2014 at 12:57:02 UTC, Andrej Mitrovic wrote:
> 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.

http://d.puremagic.com/issues/show_bug.cgi?id=5775

Actually I'm still wainting for body release ;)