[ruby-core:105867] [Ruby master Feature#11919] Passing a module directly
From:
"jeremyevans0 (Jeremy Evans)" <noreply@...>
Date:
2021-10-29 14:27:25 UTC
List:
ruby-core #105867
Issue #11919 has been updated by jeremyevans0 (Jeremy Evans). Dan0042 (Daniel DeLorme) wrote in #note-11: > @jeremyevans0 may I ask why you closed this? Matz has not rejected this idea. He only rejected `refine X do` (#14344) because `refine` should not have such different behavior for class vs module. @matz pretty much rejected `using do` as well (https://bugs.ruby-lang.org/issues/14344#note-15): `the modified syntax using do is also confusing`. So that's why I closed this (this feature is for `using do`). > Although there's also `refining X do` (#16241) which may be a better choice since it has Matz' pre-approval. Not sure where you are seeing pre-approval by @matz in #16241. I guess in the description it says that @matz indicated `refining` seems like a better name than `using_refined`, but that doesn't sound like pre-approval to me. #16241 hasn't been rejected yet, though. Personally, I'm not in favor of adding another method for this, so I wouldn't submit a pull request to implement that. ---------------------------------------- Feature #11919: Passing a module directly https://bugs.ruby-lang.org/issues/11919#change-94405 * Author: sawa (Tsuyoshi Sawada) * Status: Rejected * 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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>