From: dementiev.vm@... Date: 2019-02-07T21:13:27+00:00 Subject: [ruby-core:91482] [Ruby trunk Feature#14344] refine at class level Issue #14344 has been updated by palkan (Vladimir Dementyev). matz (Yukihiro Matsumoto) wrote: > 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. Thanks! Since this has been marked as rejected, should we propose alternatives in a new ticket or could we continue discussing here? ---------------------------------------- Feature #14344: refine at class level https://bugs.ruby-lang.org/issues/14344#change-76741 * 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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>