From: "bughit (bug hit)" Date: 2021-11-18T21:59:42+00:00 Subject: [ruby-core:106160] [Ruby master Feature#11256] anonymous block forwarding Issue #11256 has been updated by bughit (bug hit). mame (Yusuke Endoh) wrote in #note-16: > @matz accepted this, but said that the formal argument must explicitly receive a anonymous block parameter, i.e. > > ``` > def foo(&) = bar(&) # OK > def foo = bar(&) # NG > ``` > > In the future, matz wants to make it more explicit whether a method accepts a block or not. > Where is the naked ampersand in def foo(&) described? Don't see it here: https://docs.ruby-lang.org/en/master/doc/syntax/methods_rdoc.html Does it mean the block is required? What is the reason for the restriction? The block may or may not be passed to `def foo`, so what is wrong with forwarding it or its absence with `&`? It reduces the utility of this feature, for what gain? ---------------------------------------- Feature #11256: anonymous block forwarding https://bugs.ruby-lang.org/issues/11256#change-94762 * Author: bughit (bug hit) * Status: Assigned * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) ---------------------------------------- since capturing a block into a proc is slow: foo(&block) and creating chains of blocks is kind of ugly and ultimately also inefficient: foo{yield} why not allow block forwarding without capturing: foo(&) foo(1, 2, &) -- https://bugs.ruby-lang.org/ Unsubscribe: