[#101179] Spectre Mitigations — Amel <amel.smajic@...>
Hi there!
5 messages
2020/12/01
[#101694] Ruby 3.0.0 Released — "NARUSE, Yui" <naruse@...>
V2UgYXJlIHBsZWFzZWQgdG8gYW5ub3VuY2UgdGhlIHJlbGVhc2Ugb2YgUnVieSAzLjAuMC4gRnJv
4 messages
2020/12/25
[ruby-core:101291] [Ruby master Bug#17374] Refined methods aren't visible from a refinement's module
From:
marcandre-ruby-core@...
Date:
2020-12-07 20:19:20 UTC
List:
ruby-core #101291
Issue #17374 has been updated by marcandre (Marc-Andre Lafortune).
Eregon (Benoit Daloze) wrote in #note-4:
> In the original example, there is no way to know that Implementation will be followed by `refine`, and that the methods declared there should be affected.
>
> What you are asking is I think dynamic rebinding
I might be confused as to what dynamic rebinding is; for me the constraint was that there could not be later redefinitions of refinements, that everything had to had been already defined (which is the case).
When `refine { include Mod }`, I would like the `include` to "duplicate" the *current* methods of `Mod`, just as if I had written them with `def` at that point. Ideally they would be in a different layer than the current refinement, so you could use `prepend`, `def` and `include` on the same method, but at this point that is minor.
Note that I tried `refine { define_method :foo, Mod.instance_method(:foo) }` and that does not work either.
> because what should happen if:
> ```ruby
> module R1
> refine Foo do
> prepend Foo::Implementation
> end
> end
>
> module R2
> refine Foo do
> prepend Foo::Implementation
> end
> end
> ```
More or less the same as if you replaced the `prepend` with the `def`s of `Foo::Implementation` as they were defined at the time.
----------------------------------------
Bug #17374: Refined methods aren't visible from a refinement's module
https://bugs.ruby-lang.org/issues/17374#change-88975
* Author: marcandre (Marc-Andre Lafortune)
* Status: Open
* Priority: Normal
* Assignee: shugo (Shugo Maeda)
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>