[#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:84201] [Ruby trunk Feature#11256] anonymous block forwarding
From:
nobu@...
Date:
2017-12-12 10:04:58 UTC
List:
ruby-core #84201
Issue #11256 has been updated by nobu (Nobuyoshi Nakada).
Current patch.
```diff
diff --git a/parse.y b/parse.y
index 1026d5c896..2a98016002 100644
--- a/parse.y
+++ b/parse.y
@@ -347,6 +347,8 @@ static int parser_yyerror(struct parser_params*, const char*);
#define lambda_beginning_p() (lpar_beg && lpar_beg == paren_nest)
+#define ANON_BLOCK_ID '&'
+
static enum yytokentype yylex(YYSTYPE*, YYLTYPE*, struct parser_params*);
#ifndef RIPPER
@@ -2560,6 +2562,18 @@ block_arg : tAMPER arg_value
$$ = $2;
%*/
}
+ | tAMPER
+ {
+ /*%%%*/
+ if (!local_id(ANON_BLOCK_ID)) {
+ compile_error(PARSER_ARG "no anonymous block parameter");
+ }
+ $$ = NEW_BLOCK_PASS(new_lvar(ANON_BLOCK_ID, &@1));
+ $$->nd_loc = @$;
+ /*%
+ $$ = Qnil;
+ %*/
+ }
;
opt_block_arg : ',' block_arg
@@ -4913,6 +4927,15 @@ f_block_arg : blkarg_mark tIDENTIFIER
$$ = dispatch1(blockarg, $2);
%*/
}
+ | blkarg_mark
+ {
+ /*%%%*/
+ $$ = ANON_BLOCK_ID;
+ arg_var($$);
+ /*%
+ $$ = dispatch1(blockarg, Qnil);
+ %*/
+ }
;
opt_f_block_arg : ',' f_block_arg
```
----------------------------------------
Feature #11256: anonymous block forwarding
https://bugs.ruby-lang.org/issues/11256#change-68318
* Author: bughit (bug hit)
* Status: Assigned
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version:
----------------------------------------
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>