From: eregontp@... Date: 2018-04-16T10:03:30+00:00 Subject: [ruby-core:86550] [Ruby trunk Feature#14344] refine at class level Issue #14344 has been updated by Eregon (Benoit Daloze). I am a MRI committer. This is just my opinion, but I'm confident it is shared by other committers as well. I believe changing the semantics of `refine` (to be using+Module.new+refine) based on whether the receiver is a Class or Module is not acceptable. So, we need a new name for this feature as `refine` would be too confusing with the existing semantics. Changing the semantics for `refine` for all cases would be consistent, but introduce too large incompatibilities. So a new name seems the way forward, do you have a suggestion? ---------------------------------------- Feature #14344: refine at class level https://bugs.ruby-lang.org/issues/14344#change-71490 * Author: kddeisz (Kevin Deisz) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- I rely on refinements a lot, but don't want to keep writing `Module.new` in code. I'm proposing `Object::refine`, which would create an anonymous module behind the scenes with equivalent functionality. So: ~~~ ruby class Test using Module.new { refine String do def refined? true end end } end ~~~ would become ~~~ ruby class Test refine String do def refined? true end end end ~~~ It's a small change, but reads a lot more clearly. Thoughts? -- https://bugs.ruby-lang.org/ Unsubscribe: