From: Shugo Maeda Date: 2011-10-07T13:00:28+09:00 Subject: [ruby-core:40015] Re: problems with Refinements Hi, 2011/10/7 Steve Klabnik : > �Cons: > �- End up making libraries harder to understand, since the details of > MyLibrary's String are opaque from outside MyLibrary At this point, I think refinements are better than monkey patching because affection of refinements are limited lexically. > �- Are a pretty complex feature to use. > �- This complexity makes code with refinements hard to reason about. I admit that refinements are complex, but refinements are a feature for advanced library/framework developers. Most application programmers do not need to take care about the complexity of refinements. > Refinements for Ruby Implementors: > �Pros: > � �- Giving users a feature they want > �Cons: > � �- Complex features are complex to implement (snip) > � �- This feature affects Ruby at a very, very deep level, and > therefore deserves significant consideration Agreed. I guess implementations other than CRuby have last_class in stack frames, so for their implementors it may be easier to implement refinements than CRuby:) > � �- Refinements in particular place a large burden on send (I > think), which is what makes the performance penalty so large. I guess the performance decrease came from the change of stack frames, so implementations other than CRuby may not be affected. > Many people _do_ want refinements, but that doesn't mean that it's > good for Ruby. Agreed. I think Matz should finally decide. -- Shugo Maeda