ruby-changes:58742
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Tue, 12 Nov 2019 16:18:05 +0900 (JST)
Subject: [ruby-changes:58742] 14db635097 (master): add NEWS about _1 as a local variable [ci skip]
https://git.ruby-lang.org/ruby.git/commit/?id=14db635097 From 14db635097ef89a299531770ba8ed5800a58ab8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= <shyouhei@r...> Date: Tue, 12 Nov 2019 16:15:58 +0900 Subject: add NEWS about _1 as a local variable [ci skip] diff --git a/NEWS b/NEWS index fd17599..244d5ab 100644 --- a/NEWS +++ b/NEWS @@ -126,6 +126,11 @@ sufficient information, see the ChangeLog file or Redmine https://github.com/ruby/ruby/blob/trunk/NEWS#L126 [1, 2, 10].map { _1.to_s(16) } #=> ["1", "2", "a"] + You can still define a local variable named _1 and so on, and that is honored when present, but renders warning. + + _1 = 0 + [1].each { p _1 } # prints 0 instead of 1, but also warns. + ==== proc/lambda without block is deprecated * Proc.new and Kernel#proc with no block in a method called with a block is -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/