Keywords: How to trick the compiler?

Ary Borenszweig ary at esperanto.org.ar
Wed Jan 29 09:11:32 PST 2014


On 1/28/14, 3:17 PM, Chris wrote:
> 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 ;)

Yes, as there are other ways for body: _body, _body, Body, HtmlBody, 
etc. But "body" is the best one.


More information about the Digitalmars-d-learn mailing list