Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!talisker.lacave.net!lacave.net!not-for-mail From: 7stud -- Newsgroups: comp.lang.ruby Subject: Re: Scope problem (?) in implementing Design Patterns in Ruby Date: Wed, 11 May 2011 15:34:16 -0500 Organization: Service de news de lacave.net Lines: 61 Message-ID: <9307dd9ab066746e74f5cbc1f8d02bbf@ruby-forum.com> References: <7e6155b0-8d33-4677-87ec-be2c3f0fca97@b7g2000prg.googlegroups.com> <2ac328808edcaa956da4f286617acefb@ruby-forum.com> <4bfa1e5a3794daf70f5171094052dab0@ruby-forum.com> NNTP-Posting-Host: bristol.highgroove.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: talisker.lacave.net 1305146649 48626 65.111.164.187 (11 May 2011 20:44:09 GMT) X-Complaints-To: abuse@lacave.net NNTP-Posting-Date: Wed, 11 May 2011 20:44:09 +0000 (UTC) In-Reply-To: <4bfa1e5a3794daf70f5171094052dab0@ruby-forum.com> X-Received-From: This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway X-Mail-Count: 383007 X-Ml-Name: ruby-talk X-Rubymirror: Yes X-Ruby-Talk: <9307dd9ab066746e74f5cbc1f8d02bbf@ruby-forum.com> Xref: x330-a1.tempe.blueboxinc.net comp.lang.ruby:4295 7stud -- wrote in post #998090: > > I guess the lookup actually starts at the toplevel. Well, that's not true either. If I define two All classes: one at the top level and one inside a module, class All def greet puts 'All#greet' end end module C class All def greet puts "C::All#greet" end end class Dog def do_stuff All.new.greet #<***** end end end C::Dog.new.do_stuff --output:-- C::All#greet Then if I delete C::All: class All def greet puts 'All#greet' end end module C class Dog def do_stuff All.new.greet #<***** end end end C::Dog.new.do_stuff --output:-- All#greet ..which doesn't seem like that should work. -- Posted via http://www.ruby-forum.com/.