As an alternative, how about allowing Object#extend to take a block that =
would be executed with the context such that methods defined therein =
would become singleton methods of the object receiving #extend?

Your example would then become:

 foo =3D Object.new
 foo.extend do
   def bar
     # ...
   end
   def baz
     # ...
   end
 end

Sorry if this is impossible for some reason I don't know of,
Dave

On Mar 6, 2013, at 9:59 PM, alexeymuranov (Alexey Muranov) wrote:

>=20
> Issue #8038 has been reported by alexeymuranov (Alexey Muranov).
>=20
> ----------------------------------------
> Feature #8038: Keyword `object` to be used instead of `class <<`
> https://bugs.ruby-lang.org/issues/8038
>=20
> Author: alexeymuranov (Alexey Muranov)
> Status: Open
> Priority: Normal
> Assignee:=20
> Category: core
> Target version: Next Major
>=20
>=20
> =3Dbegin
> I propose to introduce a new keyword (({object})) and to use it =
instead of the mysterious (({class <<})):
>=20
>  object foo
>    def bar
>      # ...
>    end
>    def baz
>      # ...
>    end
>  end
>=20
> instead of
>=20
>  foo =3D Object.new
>  class << foo
>    def bar
>      # ...
>    end
>    def baz
>      # ...
>    end
>  end
> =3Dend
>=20
>=20
>=20
> --=20
> http://bugs.ruby-lang.org/
>=20