>>>>> "M" == Mark Slagell <ms / iastate.edu> writes:

M> (1) A top-level method gets appended to the Object class and made private,
M> then? ... whereas it seems to me more natural that it should be appended to
M> self as a singleton method.  That yields the same function-like behavior, and
M> an error message that makes more sense if it's called other than as a
M> function.  Are there other implications I'm missing?

 Perhaps this case ?

pigeon% cat b.rb
def self.foo
   p 5
end
 
def bar
   p 12
end
 
class Array
   def toto
      bar
      foo
   end
end
 
Array.new.toto
 
pigeon%

pigeon% ruby b.rb
12
b.rb:12:in `toto': undefined local variable or method `foo' for []:Array (NameError)
        from b.rb:16
pigeon% 


Guy Decoux