From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=3.0 tests=AWL,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 612E81F5AE for ; Tue, 28 Jul 2020 18:31:08 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id EEEA3120999; Wed, 29 Jul 2020 03:30:32 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id D1C53120993 for ; Wed, 29 Jul 2020 03:30:28 +0900 (JST) Received: by filterdrecv-p3las1-7754f7d4cc-kchn9 with SMTP id filterdrecv-p3las1-7754f7d4cc-kchn9-18-5F206EDF-3C 2020-07-28 18:30:55.484561755 +0000 UTC m=+2852235.490272204 Received: from herokuapp.com (unknown) by geopod-ismtpd-4-2 (SG) with ESMTP id czNIqEIdSkaOLCwlD80UAA for ; Tue, 28 Jul 2020 18:30:55.325 +0000 (UTC) Date: Tue, 28 Jul 2020 18:30:55 +0000 (UTC) From: eregontp@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 75164 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 12671 X-Redmine-Issue-Author: headius X-Redmine-Sender: Eregon 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-SG-EID: =?us-ascii?Q?KippOI8ZHtTweq7XfQzW93937kJ4QNWwSBuHnaMEcr0SkLXQ+JnQfmcRaJ3trI?= =?us-ascii?Q?Pnl6H+QV7iRO+GMB2scWXduwLBcJJZpVgbbpsiZ?= =?us-ascii?Q?qOXDwxJ1PmlroSCCHWBejiEhA+H8ykgjzCm+g1i?= =?us-ascii?Q?tOQjD8hWzNFMPiKKfkc10iQwJBPIiNGcVFsOjb3?= =?us-ascii?Q?5OYfhfuBsMSv0NjCPEv=2FOHDDdw1yNJT79tstGEd?= =?us-ascii?Q?TOGV4GrhRwv9Sb6F8=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 99368 Subject: [ruby-core:99368] [Ruby master Bug#12671] Hash#to_proc result is not a lambda, but enforces arity X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #12671 has been updated by Eregon (Benoit Daloze). Looking at the commit, should Hash#to_proc use `rb_func_lambda_new()` instead of `rb_func_proc_new()`? (and then `rb_func_proc_new` is unused) Also it seems confusing that `rb_func_proc_new()` creates a lambda, so using `rb_func_lambda_new()` seems better here. ---------------------------------------- Bug #12671: Hash#to_proc result is not a lambda, but enforces arity https://bugs.ruby-lang.org/issues/12671#change-86771 * Author: headius (Charles Nutter) * Status: Open * Priority: Normal * ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14] * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- ``` $ ruby23 -e 'pr = {foo:1}.to_proc; puts pr.lambda?; pr.call rescue puts $!; pr.call(1, 2) rescue puts $!' false wrong number of arguments (given 0, expected 1) wrong number of arguments (given 2, expected 1) ``` I believe it should be marked as a lambda, since it enforces arity. -- https://bugs.ruby-lang.org/