Why Ruby?
Stephan Soller
stephan.soller at helionweb.de
Mon Dec 13 02:32:36 PST 2010
On 12.12.2010 18:01, Simen kjaeraas wrote:
> so <so at so.do> wrote:
>
>>> If we take a look at the very first code example from the talk it
>>> looks like this:
>>>
>>> account.people.each do |person|
>>> puts person.name
>>> end
>>>
>>> You could translate this in two ways when translating into D.
>>> First way:
>>>
>>> foreach (person ; account.people)
>>> writeln(person.name);
>>
>> Am i alone thinking D one better here?
>
> Absolutely not. Ruby reads like Yoda-speak, while D is almost plain
> English. Had foreach used 'in' instead of the semicolon, only
> punctuation and 'ln' would be off.
>
Unfortunately I have to disagree here. If you have well written Ruby
code (like Ruby on Rails usually provides) it can usually be read like
plain English. That's the reason why I dropped writing documentation
comments for Ruby code: it's just redundant.
I'm not at home so I can't post a good example. However I once built a
website in Ruby on Rails together with another person responsible for
the content. This person had no programming experience what soever.
Because I hadn't completed some backend stuff the development version of
the website threw an exception and the code of the action was displayed.
I was curious and asked here if she was able to understand what these
lines do. She was actually able to exactly tell me what the code was
doing... without ever learning about programming. I doubt this would
have been possible with D code.
Happy programming
Stephan Soller
More information about the Digitalmars-d
mailing list