From: eregontp@... Date: 2020-11-20T19:22:31+00:00 Subject: [ruby-core:100991] [Ruby master Feature#16241] Shorter syntax for anonymous refinements Issue #16241 has been updated by Eregon (Benoit Daloze). This sounds fine to me. I think `using do; refine Array do; ...; end; end` would be a good way too (https://bugs.ruby-lang.org/issues/17336#note-6), but matz thinks it's confusing whether the block is for defining refinements or for using refinements, and whether refinements apply after (https://bugs.ruby-lang.org/issues/14344#note-15). ---------------------------------------- Feature #16241: Shorter syntax for anonymous refinements https://bugs.ruby-lang.org/issues/16241#change-88657 * Author: palkan (Vladimir Dementyev) * Status: Open * Priority: Normal ---------------------------------------- The original discussion is here https://bugs.ruby-lang.org/issues/14344. tl;dr - Refinements are often used in-place with anonymous modules - Having shorter syntax could lower the barrier of entry for Rubyist wanting to explore this feature - Previous syntax suggestions were not accepted. I suggest adding a shorter syntax (technically, API): ```ruby # before using(Module.new do refine Array do def foo;"bar";end end end) # after refining Array do def foo; "bar"; end end ``` The original idea was to use `using_refined` instead of `refining` but after discussing with Matz we decided that it's too verbose, and `refining` seems better. But is it good enough? Any thoughts? -- https://bugs.ruby-lang.org/ Unsubscribe: