[#84280] [Ruby trunk Bug#14181] hangs or deadlocks from waitpid, threads, and trapping SIGCHLD — nobu@...
Issue #14181 has been updated by nobu (Nobuyoshi Nakada).
3 messages
2017/12/15
[#84398] [Ruby trunk Bug#14220] WEBrick changes - failures on MSWIN, MinGW — Greg.mpls@...
Issue #14220 has been reported by MSP-Greg (Greg L).
3 messages
2017/12/22
[#84472] Re: [ruby-dev:50394] [Ruby trunk Bug#14240] warn four special variables: $; $, $/ $\ — Eric Wong <normalperson@...>
Shouldn't English posts be on ruby-core instead of ruby-dev?
3 messages
2017/12/26
[ruby-core:84260] [Ruby trunk Feature#11256] anonymous block forwarding
From:
eregontp@...
Date:
2017-12-14 10:09:43 UTC
List:
ruby-core #84260
Issue #11256 has been updated by Eregon (Benoit Daloze).
Just my opinion, but I think the shortcut syntax is going to cause more confusion than it would help.
`&` as argument without a `&` as a parameter looks very weird to me (it's like `it` in other languages, I would strongly advise against such magic).
I argue adding this makes Ruby less readable as a language.
This only saves one character in the definition, and it's not hard to name a block: &b or &block,
that's what the Ruby code out there uses and is clear *because of it*.
Moreover, it's inconsistent with arguments which must be named to be passed (except via zsuper):
`foo(*)` does not work as a call, and `def meth(*)` means ignore arguments, which is meaningless for blocks (just omitting &b is enough to ignore a block).
This also seems to conflict with one of the nicer proposals for short block notations like
enum.map(&.to_s.upcase.ljust(3)), a much more general and useful feature than this shortcut,
which only applies for a few methods forwarding the block and saves 2 character per forwarding method.
Also, the original poster started with "since capturing a block into a proc is slow: foo(&block)".
There is no such reason anymore, and I see no clear motivation of why such a special edge-case syntax is worth adding.
From the developer meeting notes, [Feature #11256] anonymous block forwarding:
Matz: it’s a good property to avoid naming variables. Also I personaly like it. However prompting such name-less programming might let people write cryptic codes.
Matz: hmm… Made up my mind. Accepted.
I agree it is cryptic and moreover argue it has little use, is inconsistent with other arguments and likely to cause syntax restrictions for other features.
@bughit Could you explain your motivation for this shortcut now that the performance is no longer a concern?
I agree `foo{yield}` was not nice, but is it worth to have `foo(&) foo(1, 2, &)` over `foo(&b) foo(1, 2, &b)` ?
@matz Could you detail your opinion and reconsider?
----------------------------------------
Feature #11256: anonymous block forwarding
https://bugs.ruby-lang.org/issues/11256#change-68410
* Author: bughit (bug hit)
* Status: Assigned
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: next minor
----------------------------------------
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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>