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-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-2.6 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=no 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 91A461F4B4 for ; Fri, 9 Apr 2021 09:02:38 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id CCC001212C1; Fri, 9 Apr 2021 18:01:37 +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 20ACA1212BE for ; Fri, 9 Apr 2021 18:01:35 +0900 (JST) Received: by filterdrecv-59db977c98-mgjlc with SMTP id filterdrecv-59db977c98-mgjlc-14-6070182A-80 2021-04-09 09:02:34.571656726 +0000 UTC m=+1267113.396712747 Received: from herokuapp.com (unknown) by ismtpd0178p1iad2.sendgrid.net (SG) with ESMTP id nmLs0ArfQB-kZwwT_pSDjQ for ; Fri, 09 Apr 2021 09:02:34.469 +0000 (UTC) Date: Fri, 09 Apr 2021 09:02:34 +0000 (UTC) From: zverok.offline@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 79384 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 17789 X-Redmine-Issue-Author: soudai_s X-Redmine-Sender: zverok 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?3be0g8093pjUjT94eiCA64csFDBI=2FmHQTWm54P5gda5ex0JZKmudMPGsxj1gnf?= =?us-ascii?Q?k5WozHsx=2FcKJOoDIO0jGaMZU0c2Ul=2FICFT+1RYk?= =?us-ascii?Q?cmmK4amgzLr20mfl805xOEKcjbafrvNK8vLf4Ns?= =?us-ascii?Q?u2c0bvp0o1Yn0mvtfUJajNuLY9iej0PiSWU=2Fer7?= =?us-ascii?Q?8TQdobe+jTfyDeBR38CoURctIqTuaFCEvIoyxgz?= =?us-ascii?Q?t2Hjr5WNvdDsWawNw=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 103338 Subject: [ruby-core:103338] [Ruby master Bug#17789] Incompatible behavior of Enumarator::Lazy#with_index 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 #17789 has been updated by zverok (Victor Shepelev). It doesn't ignores the block. It is just lazy to perform it :) ```ruby %w(a).lazy.with_index { |s, i| puts "#{s} => #{i}" } # => # %w(a).lazy.with_index { |s, i| puts "#{s} => #{i}" }.force # a => 0 ``` ---------------------------------------- Bug #17789: Incompatible behavior of Enumarator::Lazy#with_index https://bugs.ruby-lang.org/issues/17789#change-91429 * Author: soudai_s (Soudai Sasada) * Status: Open * Priority: Normal * ruby -v: ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-darwin20] * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- this method ignores the block passed to it, but this behavior looks different from the Enumerator (super class). ``` $ ruby -e '%w(a).lazy.with_index { |s, i| puts "#{s} => #{i}" }' a => 0 # Expected, but doesn't actually print anything ``` After confirmation I found #16414 but this behavior was not fixed and the doc in the modified source code states: "If a block given, iterates the given block for each element". Is this behavior intended? -- https://bugs.ruby-lang.org/