From: Shugo Maeda Date: 2010-12-03T14:34:59+09:00 Subject: [ruby-core:33538] Re: [Ruby 1.9-Feature#4085] Refinements and nested methods Hi, 2010/11/30 Jedediah Smith : > There are many ways for refinements to leak out of the lexical scope that uses them: That is why I called it *pseudo*-lexical. > 1. Inheritance (which is used in many APIs e.g. ActiveRecord::Base) I guess this needs more discussion. We may need something like `private using' which does not affect subclasses. > 2. DSLs that use instance_eval > 3. Re-opening a class I guess they are more controllable than inheritance. But they may have other problems as pointed out by Charles. > 4. When a class that uses refinements is itself refined (or does it not work that way?) I guess it doesn't work that way because we have no local rebinding. > Also, if "using" and "include" both operate on modules, the difference between them is going to be confusing, particularly for those unfamiliar with the history of the language. It seems arbitrary to overload modules with a use unrelated to their existing purpose. And having to group refinements in modules seems overly complicated for many cases. I would like to be able to do something like this: I don't think it's so confusing. It complies with the Large Class Principle. -- Shugo Maeda