Afficher un message
Vieux 24/02/2008, 03h43   #15
Phlip
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Monkeypatching is Destroying Ruby

> http://avdi.org/devblog/?p=18

> Monkeypatching has become the hip thing to do in the
> Ruby and (especially?) Rails communities, and it has
> reached the point where experienced programmers are
> turning to it as the tool of first resort *even* when there
> is a simpler, more traditional solution available. I
> suggest that it's time for Ruby hackers to start setting a
> better example.


I don't know what "Aspect Oriented Programming" (and please don't try the
standard explanations - they don't work on me, any more than "OO is about
modeling the Real World in objects...").

I want this:

module MyModule
class ::String
def inspect
return 'shock the monkey'
end
end
end

I want .inspect, or whatever, outside my module, to behave normally. But if
you inspect a string while my module is above you on the call stack, I get
my hotwired version of .inspect.

Does anyone have a Ruby Hack which does that yet? How hard would it be?

--
Phlip
http://assert2.rubyforge.org/


  Réponse avec citation
 
Page generated in 0,05017 seconds with 9 queries