From: Charles Oliver Nutter Date: 2009-02-25T13:49:27+09:00 Subject: [ruby-core:22447] Re: YASNP (Yet Another Selector Namespace Proposal) Jim Deville wrote: > I agree that this will be used in ways other than just framework > creators. Rails and Merb may not use this to erect fences, but someone > will. I think that before we go gung-ho on this, there should be a > Devil���s advocate discussion of how one could misuse this feature, and > how it could cause problems. The problems may not warrant dropping the > idea, they may just help see issues with it. I think that is a really > good exercise that we should do. > > As an example, what if I am using Merb, and two plugins, which all > define a namespaced method, which I want to change. That���s three > namespaces that I have to __know about__ and modify. As opposed to one now. Going out and changing (monkeypatching) libraries (or namespaces) willy-nilly is what called for something more localized to begin with. I've yet to see a case that monkeypatching makes simpler or easier, and this is no different. I think it's a question of what sort of pain you bring on yourself. If you monkeypatch libraries, and someone else's patch conflicts, you both deserve to get your knuckles rapped. If you monkeypatch someone else's module and it leads to more complicated code or eventual bugs, you deserve to get your knuckles rapped. If anything, the namespace proposal is vastly safer than monkeypatching to begin with...so much so that it could probably take over most of monkeypatching's use cases, leading to *better* code. I understand the concern, but anyone arguing that "feature X combined with monkeypatching is too dangerous/confusing/complicated" should probably consider whether it's monkeypatching's fault in the first place. - Charlie