Hi,

In message "Thought about class definitions"
    on 04/03/09, Dave Thomas <dave / pragprog.com> writes:

|If we allowed
|
|    class <expr>
|
|Then I could write
|
|    class Struct.new(:name, :age)
|       def to_s
|         "#{self.name} is #{self.age} years old"
|       end
|    end
|
|Which would be nice. I quite often extend Structs, and being able to do 
|it in one step seems like a tidy idea.

I can't explain the semantics for normal case, for example, in

  class Foo<Bar
  end

Foo is undefined at the point.  Thus I don't think I will accept
this.

|An alternative might be to have Struct.new do a class_eval:
|
|     Struct.new(:name, :ago) do
|        def to_s
|          ...
|        end
|     end

This is much better.  Will be available in 1.9.

							matz.