From: Trans Date: 2008-02-27T20:36:35+09:00 Subject: Re: Monkeypatching is Destroying Ruby On Feb 26, 9:44 pm, furtive.cl...@gmail.com wrote: > On Feb 26, 11:34 am, ThoML wrote: > > > [...] > > My point rather is this should somehow be standardized, i.e. the standard > > library should provide standard means to do this. > > This is what I was attempting to say in my previous post on this > thread. You mentioned defadvice, which is a good example of a "long > reach" mechanism employed by top-level code in order to tweak lower- > level code. The reason this thread exists is because there is no > centralized mechanism in ruby to help programmers from stepping on > each others' toes. Making ad hoc modifications to base-level classes > is not a scalable practice. > > So I will ask my question again: Is (or was) there a serious plan for > something like selector namespaces in ruby 2.0? I foundhttp://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... Solutions to this tend to be pretty weighty. Ruby is already a rather slow language. A while back I suggested this idea: module MyModule class String < ::String def something; "something"; end end def self.tryme "string".something end end def tryme2 "string".something end MyModule.tryme #=> "sometging" tryme2 #=> NoMethodError Austin thought it was the worst idea in the world. He may be right, I'm not sure. In either case it would add another level of consideration to the language. > Responses such as "What is the problem?" come from those who have been > lucky enough to evade these issues in their own work. But eventually > one will wish to use some code written by someone else which > introduces conflicts. It's only a matter of time, unless you > personally write every line of code in your project. So the answer to > "What is the problem?" is that the technique doesn't scale. What technique is perfectly scalable? There is always the potential of name clash no matter what technique is used. It's an unfortunate fact of life, but if the library you are trying to use is poorly written -- well, then life sucks. Fix the library or find another. I think you may be looking foe a magic bullet that doesn't exist. Also, do you have examples of this issue? T.