From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [94.130.110.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 1523F1F4CC for ; Thu, 19 Dec 2024 09:33:21 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; unprotected) header.d=ml.ruby-lang.org header.i=@ml.ruby-lang.org header.a=rsa-sha256 header.s=mail header.b=IrYxyFoi; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=D0tMLUxg; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1734600799; bh=ASnzQcvyU5CzOMMMa7OjrvLMl0ypeb65k2Oiz4ycEJ4=; h=Date:References:To:Reply-To:Subject:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Cc:From; b=IrYxyFoiq7DZqgH0qSmE3ORvsRBBi192ppL7p2kQ2+7I65rwTjLdrMYEGGugZQoPR 7Q8CtzCcFEHZmeQbOwrLiy93fBTGBqWnC32q+IQHAh3Nu+A0AhgvUsRAUeqrF4p/Sh B1+BX52G5eWwCw8LKLLJs9aq191Vj0TW2RNENO+k= Received: from nue.mailmanlists.eu (localhost [IPv6:::1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 9C5FC44F07 for ; Thu, 19 Dec 2024 09:33:19 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=pass (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=D0tMLUxg; dkim-atps=neutral Received: from s.wrqvtbkv.outbound-mail.sendgrid.net (s.wrqvtbkv.outbound-mail.sendgrid.net [149.72.123.24]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 66FF444CA5 for ; Thu, 19 Dec 2024 09:33:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ruby-lang.org; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:from:subject:to; s=s1; bh=MmGlUVsUluQRl4oSsZJ+Wol3fwBqSYedX3OiBM+rMjk=; b=D0tMLUxg2AwI2Go0UZhwRswm3kWp4VWB0Vx/5i2zSoZBpLpCuRxnzKfOsC1peHNcaxvH ipnSGTC2RWkxGS3NZUmhSXLp+hSGHef3f6Tnjpf0/c9kjaoiygrCbMOcjeIOFVMd0TW4Vc z8pz3fIOXazWVhC60aPxxM0uBQX6olAMMGha5mQkgN9uVvObxyKuTcRB1Ce1S/Y0iFLjOv EmF/aMH3o2rK3IKOR/4Yrqcfp9Ynavo3PMu4cv8Noc4jMTlIHeR1OUzdkQAIlZbBshBboa 5ulI7hfSDxhCtaYz9Vx2ZV3Q+YllScCbUwPTTUCM1UkRwohr4eHXeELDnzrpraDQ== Received: by recvd-786d47b7ff-6k497 with SMTP id recvd-786d47b7ff-6k497-1-6763E85A-E 2024-12-19 09:33:14.248604811 +0000 UTC m=+2981493.302716059 Received: from herokuapp.com (unknown) by geopod-ismtpd-17 (SG) with ESMTP id kh7lqS-ETlKROrZUUbd5HA for ; Thu, 19 Dec 2024 09:33:14.219 +0000 (UTC) Date: Thu, 19 Dec 2024 09:33:14 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 20965 X-Redmine-Issue-Author: zverok X-Redmine-Issue-Priority: Normal X-Redmine-Sender: tompng X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-Redmine-MailingListIntegration-Message-Ids: 97003 X-SG-EID: =?us-ascii?Q?u001=2E6lsr3vWETlnb7CBjJOIVTeDyJi+6PdirmC=2FsKYr6MUleSZrjBxRsGPCJC?= =?us-ascii?Q?i9WOL5Su0kL3wxEGMWtXRNWLbnUY3F6jcf9Xi5o?= =?us-ascii?Q?rvioAGXtToiGvj+w+Rwi786T+149NCaIH420PXH?= =?us-ascii?Q?GkMXvxdUKQwmKIsDtzaNqcozZ4GWa5wsu4iLkfL?= =?us-ascii?Q?fnjrRQ0kTGjCFudgJmR2rrPSNbCmRElyrgh+ytG?= =?us-ascii?Q?1unUwOFtWWqkc660n0zkyv7rbPewul=2FAH=2FM34kv?= =?us-ascii?Q?71N6gj7jlDLx7TFplKZjuv4BBw=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: NVO52NNXYYQ4MFJFFPIQHGQHKPIXUTC7 X-Message-ID-Hash: NVO52NNXYYQ4MFJFFPIQHGQHKPIXUTC7 X-MailFrom: bounces+313651-b711-ruby-core=ml.ruby-lang.org@em5188.ruby-lang.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:120326] [Ruby master Bug#20965] `it` vs `binding.local_variables` List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "tompng (tomoya ishida) via ruby-core" Cc: "tompng (tomoya ishida)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20965 has been updated by tompng (tomoya ishida). I have a concern of making `it` parameter an lvar. ~~~ruby 1| 42.tap do 2| p binding.local_variable_get('it') 3| it /1/i 4| p it 5| end ~~~ When parser reads `p it` at line 4, `it` turns out to be a local variable, I think from the beginning of the block(from line 2). But on line 3, `it /1/i` is already parsed as if lvar `it` does not exist. It is impossible to re-parse the block again, so the original implementation(it parameter is not an lvar) makes sense to me. ---------------------------------------- Bug #20965: `it` vs `binding.local_variables` https://bugs.ruby-lang.org/issues/20965#change-111096 * Author: zverok (Victor Shepelev) * Status: Closed * ruby -v: ruby 3.4.0dev (2024-12-15T13:36:38Z master 366fd9642f) +PRISM [x86_64-linux] * Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED ---------------------------------------- `it` is not available in the list of `binding.local_varaibles`, **unlike** numbered parameters: ```ruby p(proc { binding.local_variables }.call) # [] p(proc { |x| binding.local_variables }.call) # [:x] p(proc { _1; binding.local_variables }.call) # [:_1] p(proc { vars = binding.local_variables; _1; vars }.call) # [:_1, :vars] p(proc { it; binding.local_variables }.call) # [] ``` I wonder if it is deliberate or accidental. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/