I notice Reia nicely implements pattern matching on calls:
>> module Foo
.. def bar(:z)
.. "The answer is z".puts()
.. end
.. def bar(:y)
.. "Or is it y?".puts()
.. end
.. end
=> Foo
>> Foo.bar(:z)
The answer is z
=> "The answer is z"
>> Foo.bar(:y)
Or is it y?
=> "Or is it y?"
However, this doesn't work if you define bar(:z) first, then later
reopen the module and define bar(:y).
Imagine that when you def method(args), this definition was put *in
front* of all the other definitions at that arity. This would allow
you to override a method with a more specific definition for
particular input patterns. But suppose there were also some way to
call the old method definition starting from the next point in the
chain, like 'super' for class inheritance. This would give you a way
to enhance any method with extra processing before or after - like
alias_method_chain but less ugly.
It all sound like a global scope monkey patching.
There's a healthy alternative to this in Ruby:
http://timeless.judofyr.net/refinements-in-ruby
I think Reia may adopt it when it codes to library growth
(and disable monkey patching for reasons other than loading
new code)
Phil
-----Original Message-----
> --
> You received this message because you are subscribed to the Google Groups "Reia" group.
> To post to this group, send email to re...@googlegroups.com.
> To unsubscribe from this group, send email to reia+uns...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/reia?hl=en.
>