On Sunday, June 15, 2003, at 05:09 PM, you CAN teach an old dog ... 
wrote:

> [snip]

> And, along the way, any answers to my question (on a separate thread)
> about why
>    def ... end
> returns nil, instead of some kind of method object; and
>    class ... end
> returns the last expression, also instead of some kind of class
> instance.
> [snip]

   def ... end
does not return a method object because methods are not objects in Ruby 
(unless wrapped in a proc object). I don't know Smalltalk, but I have 
heard that this is one of the differences between Ruby and Smalltalk.

I am interested to know what would you want to do with a method object 
that was returned after
   def ... end

The above is a serious question.

As to
   class ... end
In my irb, the above also returns nil. I don't know the actual reason 
that this design choice was made, but I assume that if the new class 
needs arguments, this could be a problem and that the usual case would 
be to create an object separate from the class declaration, therefore, 
to turn this characteristic off would usually be required. As it is, 
you can create an object of a class at any point in the program, 
including immediately after the class is declared -- in other words, 
turn on the behavior you want. Again, I'm curious to know why you want 
this (if you do).

Regards,

Mark