From: Jeffrey Moss Date: 2005-07-29T02:12:21+09:00 Subject: Re: method_missing crazyness Multimethods with optional typed argument lists would be totally awesome. It wouldn't break backward compatibility either. Wasn't that the most popular requested feature for ruby 2? As for the method_missing trick, I think it is too much of a special case, because what if you want to use a custom prefix instead? It would have to work out like this instead: def prefix_/(a-zA-Z0-9_)/(*args) do something with $1 end This is one of those eye candy things that doesn't expand usability much. I would continue using method_missing, personally, because I feel like its more organized. -Jeff ----- Original Message ----- From: "gabriele renzi" Newsgroups: comp.lang.ruby To: "ruby-talk ML" Sent: Thursday, July 28, 2005 9:51 AM Subject: Re: method_missing crazyness > leon breedt ha scritto: >> Hi, >> >> 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? >> > > IMO, it would be cool to have multiple dispatch based on ===, so that you > could write > > def m(s) > :default > end > > def m(/:alpha:/ s) > :alphabetic > end > > it would be nice even because all methods such as > def m(x) > conditional branch > other branch > other branch > end > > could be splitted in many different cases. > Just think of what ActiveRecord::Base#find does to get why this would be > nice ;) > > >