From: Hugh Sasse Date: 2006-10-28T03:44:35+09:00 Subject: Re: classless methods On Sat, 28 Oct 2006, matt neuburg wrote: > Jason Merrill wrote: > > > And since Object is an ancestor of pretty much everything in ruby, > > it's interesting to note that these methods are now defined for > > practically everything in ruby: > > > > irb(main):001:0> def say_hello > > irb(main):002:1> "Hello" > > irb(main):003:1> end > > => nil > > irb(main):004:0> say_hello > > => "Hello" > > irb(main):005:0> [1,3,5].say_hello > > => "Hello" > > But that's just a vagary of how irb works. You couldn't do that in a > real script. m. Why not? say_hello is now a method of Object, an ancestor of [1,3,5]. Challenge: show us what the error is when it fails. :-) Hugh