From: "zverok (Victor Shepelev)" Date: 2021-10-28T11:07:13+00:00 Subject: [ruby-core:105844] [Ruby master Feature#11919] Passing a module directly Issue #11919 has been updated by zverok (Victor Shepelev). Discussed here, also: #16241 Copying my comment from there: > I believe that is really a super-good thing. As I've written elsewhere in this tracker, the most useful case for refinements is "in the current module, I want some shortcuts for my code to look cleaner". For example, [here](https://github.com/zverok/drosterize) and [here](https://github.com/zverok/xkcdize) I experimented with representing some graphics algorithms in a most "readable" way, adding really small methods to the core (Numeric) and RMagick objects. The point is "here, in this module, I crave for some things to exist in some objects". > So, "inplace refinements" is probably the main kind of refinements the developer could care about; while "refinements in a module" could be used, probably, for some "more hygienic" ActiveSupport-alike gems, or some specific blends of Ruby (like `using Geometry` with a ton of specific geometry-related services added to numbers and matrices and whatnot). ---------------------------------------- Feature #11919: Passing a module directly https://bugs.ruby-lang.org/issues/11919#change-94378 * Author: sawa (Tsuyoshi Sawada) * Status: Feedback * Priority: Normal ---------------------------------------- Refinement requires a named module: ~~~ruby module MyRefinement refine ... ... end using MyRefinement ~~~ but often (but not always), refinements are called by the `using` command only in once in a single file, and should not need to be named in such case. Also, the purpose of refinement is to not pollute classes with methods. Necessity to define a module and polluting the name space looks to me to go against this idea. I would like to do: ~~~ruby using Module.new do refine ... ... end ~~~ -- https://bugs.ruby-lang.org/ Unsubscribe: