Issue #7271 has been reported by ko1 (Koichi Sasada). ---------------------------------------- Bug #7271: Refinement doesn't seem lexical https://bugs.ruby-lang.org/issues/7271 Author: ko1 (Koichi Sasada) Status: Assigned Priority: Normal Assignee: shugo (Shugo Maeda) Category: core Target version: 2.0.0 ruby -v: ruby 2.0.0dev (2012-11-01 trunk 37404) [i386-mswin32_100] C_User#y is refined. Is that intentional? class C def foo p :C_foo end end module RefineC refine C do def foo p :RefineC_foo super end end end class C_User using RefineC def x C.new.foo end end class C_User def y C.new.foo end end C_User.new.x C_User.new.y #=> :RefineC_foo :C_foo :RefineC_foo :C_foo
on 2012-11-03 21:37
on 2012-11-05 03:58
Issue #7271 has been updated by shugo (Shugo Maeda). ko1 (Koichi Sasada) wrote: > C_User#y is refined. Is that intentional? Yes, it's intentional. Refinements are activated when C_User is reopend. I'm not sure whether is'a good idea or not, but if C_User.module_eval is affected by refinements, it seems natural reopened definitions of C_User are also affected. ---------------------------------------- Bug #7271: Refinement doesn't seem lexical https://bugs.ruby-lang.org/issues/7271#change-32359 Author: ko1 (Koichi Sasada) Status: Assigned Priority: Normal Assignee: shugo (Shugo Maeda) Category: core Target version: 2.0.0 ruby -v: ruby 2.0.0dev (2012-11-01 trunk 37404) [i386-mswin32_100] C_User#y is refined. Is that intentional? class C def foo p :C_foo end end module RefineC refine C do def foo p :RefineC_foo super end end end class C_User using RefineC def x C.new.foo end end class C_User def y C.new.foo end end C_User.new.x C_User.new.y #=> :RefineC_foo :C_foo :RefineC_foo :C_foo
on 2012-11-05 07:57
(2012/11/05 11:57), shugo (Shugo Maeda) wrote: > Yes, it's intentional. Refinements are activated when C_User is reopend. > > I'm not sure whether is'a good idea or not, but if C_User.module_eval is affected by refinements, it seems natural reopened definitions of C_User are also affected. I can't understand that refinement is "lexical" or not. If it affected after re-open, then it is *not* "lexical". If the location of `using' affect the result, then it seems "lexical". ([ruby-core:48773] [ruby-trunk - Bug #7269])
on 2012-11-05 08:38
Issue #7271 has been updated by shugo (Shugo Maeda). ko1 (Koichi Sasada) wrote: > (2012/11/05 11:57), shugo (Shugo Maeda) wrote: > > Yes, it's intentional. Refinements are activated when C_User is reopend. > > > > I'm not sure whether is'a good idea or not, but if C_User.module_eval is affected by refinements, it seems natural reopened definitions of C_User are also affected. > > I can't understand that refinement is "lexical" or not. > > If it affected after re-open, then it is *not* "lexical". > If the location of `using' affect the result, then it seems "lexical". > ([ruby-core:48773] [ruby-trunk - Bug #7269]) I may have confused you by the word lexical, but I used the word lexical in the sense that refinements have no local rebinding. I'm not sure whether refinements should be literally lexical or not. I guess if refinements are literally lexical it's good for performance, but how module_eval (or an alternative to apply refinements to a given block) should behave? ---------------------------------------- Bug #7271: Refinement doesn't seem lexical https://bugs.ruby-lang.org/issues/7271#change-32382 Author: ko1 (Koichi Sasada) Status: Assigned Priority: Normal Assignee: shugo (Shugo Maeda) Category: core Target version: 2.0.0 ruby -v: ruby 2.0.0dev (2012-11-01 trunk 37404) [i386-mswin32_100] C_User#y is refined. Is that intentional? class C def foo p :C_foo end end module RefineC refine C do def foo p :RefineC_foo super end end end class C_User using RefineC def x C.new.foo end end class C_User def y C.new.foo end end C_User.new.x C_User.new.y #=> :RefineC_foo :C_foo :RefineC_foo :C_foo
on 2012-12-13 06:25
Issue #7271 has been updated by shugo (Shugo Maeda). Status changed from Assigned to Closed Refinements are not activated by reopen now, so I close this ticket. ---------------------------------------- Bug #7271: Refinement doesn't seem lexical https://bugs.ruby-lang.org/issues/7271#change-34691 Author: ko1 (Koichi Sasada) Status: Closed Priority: Normal Assignee: shugo (Shugo Maeda) Category: core Target version: 2.0.0 ruby -v: ruby 2.0.0dev (2012-11-01 trunk 37404) [i386-mswin32_100] C_User#y is refined. Is that intentional? class C def foo p :C_foo end end module RefineC refine C do def foo p :RefineC_foo super end end end class C_User using RefineC def x C.new.foo end end class C_User def y C.new.foo end end C_User.new.x C_User.new.y #=> :RefineC_foo :C_foo :RefineC_foo :C_foo
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.