From: Alex Gutteridge Date: 2011-01-17T20:19:55+09:00 Subject: Re: Obscure syntax error On Mon, 17 Jan 2011 20:02:58 +0900, Peter Hickman wrote: > The format > > x ...followed by something else... > > means that x is a method and anything that follows it is a parameter. > Since you don't have a method called x you get "undefined method `x'" > just like it says in the error message. > > When x is a reference to a variable by itself it just returns its > value, but when you put a parameter after it it looks for a method > called x, because you are passing it a parameter "y" and the only > things you pass parameters to are methods so you get the "undefined > method `x'" message again. > > In the final case again you have no method called x and therefore a > parameter, in this case the :y, is unexpected. In that you don't pass > parameters to a variable only to methods. I think Rolf's point is that in *both* of those last two cases there is no method called x - the only difference being that in the first case he tries to pass a string to the non-existent method in the second a symbol. So why is the first (correctly) throwing a NoMethodError and the second gives a *syntax* error? -- Alex Gutteridge