On Sun, Feb 1, 2009 at 9:02 AM, Sean O'Halpin <sean.ohalpin / gmail.com> wrote:
> On Sat, Jan 31, 2009 at 8:03 PM, Thomas Sawyer <transfire / gmail.com> wrote:
> [snip]
>> Consider this form in place of the usual 'class << self':
>>
>>  class X
>>    extend Module.new {
>>      ...
>>    }
>>  end
>>
>> Not quite as elegant since we can't use do...end. But if #extend could
We surely can!
>> take a block:
>>
>>  class X
>>    extend do
>>      ...
>>    end
>>  end
>>
>> Then the issue becomes transparent. Even for regular objects:
>>
module Kernel
  alias_method :__extend__, :extend
  def extend mod=nil, &blk
    __extend__( mod || Module::new( &blk ) )
    self
  end
end

class A
  extend do
    def a;42 end
  end
end

a = Object::new.extend do
  def b; 49 end
end
I believe that these things are better done to your own taste and
shell not make the core larger as it is already, because there simply
is no account for taste.

HTH
Robert
-- 
It is change, continuing change, inevitable change, that is the
dominant factor in society today. No sensible decision can be made any
longer without taking into account not only the world as it is, but
the world as it will be ... ~ Isaac Asimov