3 ms·
Repost of the message, since bugs.ruby-lang.org appears to be down: Issue #4085 has been updated by matz (Yukihiro Matsumoto). Since there st
by awj 14y ago
Repost of the message, since bugs.ruby-lang.org appears to be down:
Issue #4085 has been updated by matz (Yukihiro Matsumoto).
Since there still remain undefined corner case behavior in refinements,
and the time is running out, I decided not to introduce full refinement
for Ruby 2.0. The limited Ruby 2.0 refinement spec will be:
* refinements are file scope
* only top-level "using" is available
* no module scope refinement
* no refinement inheritance
* module_eval do not introduce refinement (even for string args)
In addition, Module#include should add refinements to included modules,
e.g.
module R1
refine String do
def bar
p :bar
end
end
end
module R2
include R1
refine String do
def foo
p :foo
end
end
end
using R2
"".foo
"".bar
module R1
refine String do
def bar; p :bar end
end
end
module R2
include R1
refine String do
def foo; p :foo end
end
end
using R2
"".foo
"".bar # does not work now
You can treat top-level "using" as soft-keyword, as long as it does not
change the behavior (but performance).
Matz.