From: "Mark J.Reed" Date: 2005-12-16T07:37:40+09:00 Subject: Re: Assigning a block to a variable in Ruby Martin DeMello writes: >ajmayo@my-deja.com wrote: >> evaluate the function with parameter 1, then attempt to print the >> function itself (which Javascript will do, printing the text of the >> block) >Ruby does not do this. More specifically: in Ruby, unlike Python and JavaScript, methods are *not* variables with closure values. You can persuade Ruby to turn a method into a closure value, but that's not how they live, and methods do not occupy variable namespace. So defining a method 'foo' does not have any affect on the variable 'foo', or vice versa: irb(main):001:0> def foo; 1 end # define a method => nil irb(main):002:0> foo # calls the method => 1 irb(main):003:0> foo=2 # create a variable => 2 irb(main):004:0> foo # now this finds the variable => 2 irb(main):005:0> foo() # but the method is still there, too => 1