Issue #17429 has been updated by marcandre (Marc-Andre Lafortune).


Is there a proposal to import modules in refinements?

Something like this?

```ruby
module Code
  # ...
end

refine Object, import: Code do
  # extra methods
end
```

I still think that `include` and `prepend` within the `refine` block could have that function.

I think that having a nice way to implement methods that can be used with `include` or `using` would help adoption of refinements for gems.

----------------------------------------
Bug #17429: Prohibit include/prepend in refinement modules
https://bugs.ruby-lang.org/issues/17429#change-89452

* Author: shugo (Shugo Maeda)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
include/prepend in refinement modules has implementation difficulties such as #17007 and #17379, and tends to be misleading like #17374.
How about to prohibit it in future versions?

Method copy like #17380 may be more convenient, but it's confusing to use names include and prepend because semantics is different from the original ones.




-- 
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>