Why Ruby?
Simen kjaeraas
simen.kjaras at gmail.com
Sun Dec 12 11:30:34 PST 2010
On Sun, 12 Dec 2010 19:34:10 +0100, Nick Sabalausky <a at a.a> wrote:
> "Simen kjaeraas" <simen.kjaras at gmail.com> wrote in message
> news:op.vnl1katxvxi10f at biotronic-pc.lan...
>> 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.
>>
>
> Unless I'm mistaken, I think I heard somewhere that the original creator
> of
> Ruby is Japanese. Japanese grammar puts prepositions at the end of
> prepositional phrases and verbs at the end of predicates, so I'm guessing
> that's why Ruby ended up that way. Although Ruby's function calls are
> still
> "function/verb first, then params/nouns", so I dunno.
Asking google translate ("for each (person) in (account.people) do
(writeln( person.name ))"):
person の各 account.people は、writeln( person.name ); を行うための
--
Simen
More information about the Digitalmars-d
mailing list