From: Shugo Maeda Date: 2010-11-26T11:08:01+09:00 Subject: [ruby-core:33394] Re: [Ruby 1.9-Feature#4085][Open] Refinements and nested methods Hi, 2010/11/26 Yusuke ENDOH : > Are these intended? > > (1) > > �class Foo > �end > �module FooExtCore > � �def foo > � � �bar > � �end > � �def bar > � �end > �end > �module FooExt > � �refine(Foo) { include FooExtCore } > �end > �using(FooExt) > �Foo.new.foo > � �#=> undefined local variable or method `bar' > > I can guess what's going on, but this will be a FAQ... This behavior is intended, and you need define foo and bar inside the block passed to refine. I don't know any way to make the above code work without local rebinding. > (2) > > �class Foo > �end > �module FooExt > �end > �using FooExt > �module FooExt > � �refine(Foo) { include FooExt } > � �def foo > � �end > �end > �Foo.new.foo > � �#=> undefined method `foo' I'd like to allow the above code if possible, but it's hard for me. > Note that I don't want to attack this proposal. > I'm really for this and I hope to help improve it. > Please don't misunderstand me :-) I know it. Thanks for your helpful comments. -- Shugo Maeda