From: Curt Sampson Date: 2005-04-13T15:38:40+09:00 Subject: Re: [curiousity] why aren't declarations just syntactic sugar? On Sun, 10 Apr 2005, Dominik Bathon wrote: > module Foo > def Foo.do_me_harder > puts "Oh yes!" > end > puts do_me_harder > end > > In this case do_me_harder is a singleton method of module Foo. Oops! Shoulda read your post first. Anyway, so what's going on with this, as compared to doing the same thing outside a module declaration, which I'd understood to mean you were defining stuff in the "top-level module." Well, it's really the top-level class (i.e., Object), right? But then, def hello puts "hello" end class Object def goodbye puts "goodbye" end end Object.new.goodbye # prints "goodbye" goodbye # prints "goodbye" class Object hello # prints "hello" end Object.new.hello # private method `hello' called for # +81 90 7737 2974 http://www.NetBSD.org Make up enjoying your city life...produced by BIC CAMERA