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=0.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET,SPF_HELO_PASS, SPF_PASS autolearn=no 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 726611F4CC for ; Mon, 30 Dec 2024 10:37:03 +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=I+MpKRyt; 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=UTzjxLEU; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1735554991; bh=JOioWcHzNWpL605t9tA8TJ/NFWWIl3+1ZTRePVVjW5A=; 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=I+MpKRytd1+tSehEQ9Z0xrbO21Uyvcjqfx+wP369XGP8uXvyo023bFTJEwczDpxmN vgTXnqaKHKm+ePbxq0cBKyn/TkTBFAQ2bz1zuruSK7HWyMFQSM+d1Jd1VYTjKh1oAy 6DuamxzB6egMEjMHtbj913XVpDQVRWcQpI9YqKRo= Received: from nue.mailmanlists.eu (localhost [IPv6:::1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 4318F46129 for ; Mon, 30 Dec 2024 10:36:31 +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=UTzjxLEU; 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 0A31246171 for ; Mon, 30 Dec 2024 10:35:46 +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=PfpisMHzfkBbPxH6MjQSmTu91et3cBWKjj9pVV16lyc=; b=UTzjxLEURSsYuOjwP/6ZFNPP08fq5wQXGN+tG652826RK4PiyyvoWYzt7ZRRSqypC0M8 1PewhCkfOhKFMv9kayaRPaQZd9tGTK5i2/mS1ar1yll64Y4uLHKABbu8Q6Ppwiqu1+WGmw VXO6R2ZXx9SspHIjtJt73tE6W85EiQjGQ1yllh1ObxjVVnkAnakC9TtdI1RcC4Fbp6GKN4 pzlXY+DTzTrkua4yXIsLnhuEiUJ55QDG2CGhmfE2TgAmqIzhQVxVGD6r6uLzMAw7yviVWh S7VHo+GEJdiSUi/gFMd+8qZRfJyKOsqN2r8ZHzB6iVnOv/WstlYCbf+dhgRwW9Yg== Received: by recvd-5f54b5d587-kg8m9 with SMTP id recvd-5f54b5d587-kg8m9-1-67727781-D 2024-12-30 10:35:45.493720576 +0000 UTC m=+3935515.791542332 Received: from herokuapp.com (unknown) by geopod-ismtpd-30 (SG) with ESMTP id SNrYw-BtSQCwJWze0WYQSA for ; Mon, 30 Dec 2024 10:35:45.417 +0000 (UTC) Date: Mon, 30 Dec 2024 10:35:45 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 20943 X-Redmine-Issue-Author: nobu X-Redmine-Issue-Priority: Normal X-Redmine-Sender: byroot 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: 97122 X-SG-EID: =?us-ascii?Q?u001=2EKmNZ1u3n1vIpO8NNTdp+Q9c0ai7potxbEDLMO7SOJO=2F4KkRUz0d23466m?= =?us-ascii?Q?naiq=2F5fmA4hb60MdRMUAwHZnjIWVFu=2FrqiBOz5c?= =?us-ascii?Q?nOvkBudsSTjgD+RQWNduELhjIHV4Kzc=2FO640VkC?= =?us-ascii?Q?cMNQktrcLCwRSlAH6GE1XKeWcbN2kFbZSW0CxFF?= =?us-ascii?Q?BNlhlfcxMUeTj419YKKtuX32vk1xAyEIqaV+G=2FE?= =?us-ascii?Q?pxFnaZKFeqkEqcpQITAK=2F=2FluI5T47fQJq+YRQsX?= =?us-ascii?Q?1jcTKIPK2nCG7W8gwlkUwdk+Pg=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: U6425XI3YA2L7EEC7BSIV3KOA3JVBJRQ X-Message-ID-Hash: U6425XI3YA2L7EEC7BSIV3KOA3JVBJRQ 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:120446] [Ruby master Bug#20943] Constant defined in `Data.define` block List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "byroot (Jean Boussier) via ruby-core" Cc: "byroot (Jean Boussier)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20943 has been updated by byroot (Jean Boussier). I opened a feature request: https://bugs.ruby-lang.org/issues/20993 ---------------------------------------- Bug #20943: Constant defined in `Data.define` block https://bugs.ruby-lang.org/issues/20943#change-111226 * Author: nobu (Nobuyoshi Nakada) * Status: Open * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- >>From https://github.com/ruby/ruby/pull/12274: > A couple times in code review I've seen constants inadvertently leak to top level from within a `Struct` or `Data` do block. I think it would be nice to show reopening the `Data` class when a constant is defined, so the constant is defined within the namespace. In this case, `Measure::NONE` instead of top level `Object::NONE`. It would also show readers that it's okay to reopen a `Data` class, which seems nice since some folk might not realize. Thanks for considering! However, I think that `NONE` probably might be intended to be defined under `Measure`. Current: ```ruby Measure = Data.define(:amount, :unit) do NONE = Data.define end p NONE #=> NONE ``` Another: ```ruby Measure = Data.define(:amount, :unit) do NONE = Data.define p NONE #=> Measure::NONE end p NONE # uninitialized constant NONE (NameError) ``` @zverok How do think? -- 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/