From: Thomas Enebo Date: 2009-02-24T02:19:26+09:00 Subject: [ruby-core:22378] Re: YASNP (Yet Another Selector Namespace Proposal) Yehuda Katz wrote: > Can you explain *why* you don't like it? > > Keep in mind that most people would never use this feature... it's > mostly for frameworks to be able to make core extensions for their own > use without polluting the global space. Famous last words...One poignant blog entry can undo your statement in a heartbeat. My quick take... The good: - Clearly demarcated syntax to express that you are changing behavior. Much more visible than monkey patching. - It is lexically defined. Your semantic change only affects the code it is surrounding. The scope of the changes will not seep everywhere. Though I suspect you may end up with a boilerplate at the top of every file in your library. The bad: - This mostly just seems like monkey-patching defense to me. Maybe you are fighting the symptom and not the problem by adding this? Not sure I have much more to add to this...Redefining methods in Ruby is a reality and a powerful tool. I think you are just trying to counter-balance it so library authors can prevent users from changing your libraries behavior. Though you cannot really prevent users from doing anything right? They can still modify Merb::String to do the things you were trying to prevent in the first place. Maybe that is ok, but it still feels like if someone wrecks the API you are consuming (String for example), then they may feel the need to wreck your version of string also. Perhaps then they deserve it....then again they deserved it the second they ruined String. I feel pretty ambivalent about this... -Tom