|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
On Sep 5, 12:15 am, "Keith Rarick" <k...@essembly.com> wrote:
[....] > The real problem is that ruby provides no way to intercept method > definitions as they occur. The best you can do is notice that they > happen after the fact. what about http://blog.ntecs.de/articles/2004/0...rators-in-ruby ? This seem a very useful feature to have in ruby 2.0 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On 9/16/07, Matteo Gottardi <gomatteo@gmail.com> wrote:
> what about http://blog.ntecs.de/articles/2004/0...rators-in-ruby > ? This seem a very useful feature to have in ruby 2.0 Interesting. As long as we're willing to modify the ruby interpreter, why not just implement real decorators? There are some problems with my interface (and the one described on ntecs.de) that I was willing to live with in a pure ruby implementation. First, it's not very DRY as each decorator needs logic to lookup and replace the method and return its name. It's also a little fragile. Most importantly, though, replacing the method *after* it's been defined isn't as clean as wrapping the method object right before it gets bound to a name. Any method_added hooks will, unfortunately, be called twice. I'm not personally going to try getting a ruby patch accepted. kr |
|
![]() |
| Outils de la discussion | |
|
|