From: Dave Thomas Date: 2008-12-29T01:30:24+09:00 Subject: Re: Syntax error I don't understand On Dec 28, 2008, at 8:57 AM, Albert Schlef wrote: > I don't mind the "2 + rand 3" issue in itself. The problem is that > I've > just encountered yet another similar trivial issue[1], and it gives > me a > bad impression of the language. It's as if this compiler was sloppily > written. The reason I want to find the answers is to restore my > faith in > this very beautiful language. compare a = 99 1 + a 2 and 1 + rand 2 Clearly the first one is incorrect: you'd expect to see the message "unexpected integer" (the 2, in this case). But syntactically, the second statement is identical to the first. In this case, it's your job to disambiguate it by telling Ruby that 2 is a method parameter, and you do that by making it obvious that rand is a method invocation—you put the parentheses. Regards Dave Thomas