On 9/5/07, Yukihiro Matsumoto <matz / ruby-lang.org> wrote:

> |Could we have these two variations:
> |
> |class Foo < Foo       # <-- This is a type error in 1.8
> |   def foo; super; end # AROUND
> |end
> |
> |class Foo
> |   def foo; super; end # REDEFINE
> |end
> |
> |At least that is a conservative extension.
>
> Or maybe providing two supers, one for the current behavior, the other
> for the new.  I don't whatever name is suitable for new super yet,
> however

Hi Matz,

super for this new usage just doesn't feel right to me.

Isn't this really looking for syntactic sugar for something like:

class Foo #reopen

  alias_method :old_foo, :foo

  def foo
     old_foo  #around
  end
end

So as to avoid needing to explicitly alias the method and come up with a name?

Perhaps instead of super in this case something in the vein of  old,
or previous.

Alternatively what about instead of def

class Foo
   around foo
        #do something
        foo
       # do something else
  end
end

Which I would see as internally aliasing the existing foo, and
resolving reference to fo in the new methods body to the alias.

Or instead of around, how about wrap, with a corresponding unwrap to
back out the wrapper method?


-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/