On 7/28/05, leon breedt <bitserf / gmail.com> wrote:
> Any reason why syntax like this:
>   def prefix_/(a-zA-Z0-9_)/(suffix, *args)
>     do something with suffix
>   end
> Would be worse than doing manual dispatching in method_missing?
> 
> Seems like it could be a nifty hack at first glance, makes dynamic
> methods slightly more explicit (and a bit more intellisense
> friendly). #respond_to? could be automatically taught this as
> well, no?

Well, it's a neat idea, but from my perspective:

1. It's uglier than sin. Strictly speaking, you would want something
   like:

    def %r{prefix_([A-Za-z0-9_]+)}(method_match, *args)
      ...
    end

2. This would have very limited utility. #method_missing can be used
   to perform automatic delegation, e.g.:

    def method_missing(meth, *args)
      @my_array.__send__(meth, *args)
    end

   This would be useful only in the case where there are known sets
   of responses that are similar.

-austin
-- 
Austin Ziegler * halostatue / gmail.com
               * Alternate: austin / halostatue.ca