From: matz@... Date: 2019-02-07T06:35:41+00:00 Subject: [ruby-core:91452] [Ruby trunk Feature#14344] refine at class level Issue #14344 has been updated by matz (Yukihiro Matsumoto). Status changed from Open to Rejected I understand the need. But I cannot accept the proposed syntax for two reasons. (1) the original proposal using `refine` for classes, which is confusing with `refine` in refinement modules. (2) the modified syntax `using do` is also confusing. The scope of refinement may be in the block or the surrounding scope. Matz. ---------------------------------------- Feature #14344: refine at class level https://bugs.ruby-lang.org/issues/14344#change-76712 * Author: kddeisz (Kevin Deisz) * Status: Rejected * 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: