Hi,

2010/11/24 Shugo Maeda <redmine / ruby-lang.org>:
> As I said at RubyConf 2010, I'd like to propose a new features called
> "Refinements."


Basically I agree with your proposal, but I think that some
discussion is needed.

  - Your patch is too big.  Could you separate it to some parts?
    It is hard (for me) to review it.

  - Your patch adds `klass' to stack frame, which may cause
    big performance degradation.  We should check benchmark
    result (though I'm not so concerned).

  - API design.  Why did you select:

      module MathN
        refine(Fixnum) do
          def /(other) quo(other) end
        end
      end
      using MathN

    and not select others, such as:

      module MathN
        refine(Fixnum)
        def /(other) quo(other) end
      end
      using MathN

    or:

      MathN = refine(Fixnum) do
        def /(other) quo(other) end
      end
      using MathN

    IMO, it will be more natural to provide this feature as new
    constract with new syntax, instead of Module's methods.

  - Is it intended to reject refining module methods?

    module ComplexExt
      refine(Math) do
        def sqrt(x)
          (x >= 0 ? 1 : Complex::I) * super(x.abs)
        end
      end
    end
    #=> wrong argument type Module (expected Class) (TypeError)

-- 
Yusuke Endoh <mame / tsg.ne.jp>