In article <eee6f56d3405a57c4480046c35fca189 / refinery.com>,
Gavin Kistner  <gavin / refinery.com> wrote:
>On Feb 10, 2005, at 7:35 AM, Robert Klemme wrote:
>> "Gavin Kistner" <gavin / refinery.com> schrieb im Newsbeitrag
>> news:991b24e67ac5d4902f4b04192210830a / refinery.com...
>>>> Robert Klemme wrote:
>>>>>     class << self;self;end.class_eval do
>>> Is it to add new methods to the instance only, and not all instances
>>> derived from Foo?
>>
>> Exactly.
>
>Coming from Javascript (where every instance is trivially extensible 
>directly) that seems somewhat cumbersome.
>
>Do many people write things like:
>
>class Object
>	def instance_class
>		class<<self; self; end
>	end
>end
>
>in a common library they re-use frequently? Is there an RCR (or has 
>there been discussion) about adding a simple method like that to the 
>language, so you can simply do:
>
>f = Foo.new
>f.instance_class.class_eval{ ... }
>?
>
>Or (what I'm really looking for) perhaps it might be nice to have a 
>define_method method that worked directly for instances. Hrm, but what 
>would the syntax be? Perhaps that's not such a good idea.
>

Isn't this the common way of doing this:

  f = Foo.new
  def f.somemethod
    "in somemethod"
  end

  f.somemethod #=> "in somemethod"

Phil