From: furtive.clown@... Date: 2008-02-25T05:54:55+09:00 Subject: Re: Monkeypatching is Destroying Ruby The problem is not monkey patching itself, but that there is no unified mechanism for dealing with it. We wish to make local changes to (what is currently implemented as) global objects, namely the singletons comprising the built-in classes. That's difficult or impossible to do cleanly. Is (or was) there a serious plan for something like selector namespaces in ruby 2.0? I found http://rubygarden.org/ruby/page/show/Rite which appears to be down (google cache: http://64.233.169.104/search?q=cache:ej4aPcNY41QJ:rubygarden.org/ruby/page/show/Rite+http://rubygarden.org/ruby/page/show/Rite&hl=en&ct=clnk&cd=1&gl=us ) I have a simple example from my own experience. In one project I had a bewildering number of property sets which needed to be added, subtracted, or'd, and and'ed with each other every which way. I began using a Set class but it quickly became too cumbersome, as many of my definitions used hash literals. Inserting +,-,&,| methods into the Hash class was a tremendous help: using these operations with Hash literals GREATLY improved readability and maintainability. Now what if I made my project into a library for others to use? I want MY Hash in MY library ONLY, without affecting the client. I MIGHT be able to scope the change to Hash appropriately, for example by taking a snapshot of Hash then restoring it before returning to the client. But eventually I'll run into a case where I need to yield to client code while at the same needing MY Hash class. Thus I'll be forced to pollute the client with my funky Hash. --FC