From: Greg Weeks Date: 2007-11-11T17:11:06+09:00 Subject: Re: bug in nested defs (?) Ryan Davis wrote: > On Nov 10, 2007, at 23:40 , Greg Weeks wrote: > >> not a class, then the method is a singleton method of the context >> object. > > not quite. see "Defining a Method" of the pickaxe ed 2 on page 330. In my copy, the heading is "Method Definition", and it begins on pg 345. Are you referring to the paragraph that begins with "Outside a class or module definition"? That refers to the top-level (I believe). I omitted that example deliberately since a person who typed it in would mess up the subsequent examples. Here it is: def foo ; "foo" ;end [].foo # works By the way, I regret my statement that the rule that I stated was ugly. I thought that I was being self-deprecating about my phrasing of the rule. But on second thought, neither the phrasing nor the rule is ugly. However, it doesn't seem to work in the Definer/User example. -- Posted via http://www.ruby-forum.com/.