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 D4CC51F44D for ; Wed, 24 Apr 2024 10:40:19 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; secure) header.d=ml.ruby-lang.org header.i=@ml.ruby-lang.org header.a=rsa-sha256 header.s=mail header.b=YghVtmeq; 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=kaV7ZVT1; dkim-atps=neutral Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 3A18B844B8; Wed, 24 Apr 2024 10:40:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1713955212; bh=Bcdo8OvKeBVEOn0aem1h85DCn8pgNYTlusHcG8hgO4M=; 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=YghVtmeqFXijIljUn8FTWBRYwshh/47rRGByLRBZcXJrfe70+BA/AJ14G8SDYsnpd uncz6Wp7GFh3M5i02Fai6/i5oGm1US7H3zDQTf1Tw+8rge2CR2j65LA3bGVDLiO5aK gi3yRpH/loylhY6gUNXIEwl319tBO0eK6atQ4iZw= Received: from s.wrqvwxzv.outbound-mail.sendgrid.net (s.wrqvwxzv.outbound-mail.sendgrid.net [149.72.154.232]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 5F73E844B6 for ; Wed, 24 Apr 2024 10:40:08 +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=kaV7ZVT1; dkim-atps=neutral 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=d6ojsKqxdL65v2vG+Zanam9KamWfwPW+NuuQuVBeVQQ=; b=kaV7ZVT1f4QN79W5wDxYaPUEtJYSZ8rtXQMHDYCR8EoZ0b/CB5VkZ2tKx1eXQ0wZnfS4 i15qCEw72E8YZDEgYnOz0am/HuOS5f1MNaxM/TOkF/JExUqo7X/FBDmhpmavtbfSLY4uf6 Til+FQrKd83zXAU2jsXopcT6NreqI5sKRiDGItkhov91hoafCUJ3YVShfqUlkRutY+f07P W70vZe9BpZhp2LVSZpBAtcfjiWT5mUfpZJE0pnyStO1dOqk3KcLq55S3FKAsR07Loe5h78 Mpn6o/fSVnBs5g7vfGRz/ZfIhzk0gVcG7QvxYSSmyJoNyvmYOVMMOaWaHrR/aw6A== Received: by filterdrecv-6db7b8944d-8qs9x with SMTP id filterdrecv-6db7b8944d-8qs9x-1-6628E186-10 2024-04-24 10:40:06.379315486 +0000 UTC m=+996641.353864822 Received: from herokuapp.com (unknown) by geopod-ismtpd-0 (SG) with ESMTP id d3--LpenQAmL9GXWiawvGA for ; Wed, 24 Apr 2024 10:40:06.351 +0000 (UTC) Date: Wed, 24 Apr 2024 10:40:06 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 20444 X-Redmine-Issue-Author: esad X-Redmine-Issue-Priority: Normal X-Redmine-Sender: ufuk 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: 94274 X-SG-EID: =?us-ascii?Q?u001=2EtoxlPY7goenxC35PPmhKmmkfp2fFFKlYTeeCgonqobL7gJhDUe=2FDmBFH=2F?= =?us-ascii?Q?IR+L6I4qzFHsfnxMNAFUsS2aA1fS43BdwF921KP?= =?us-ascii?Q?DGZSBh1Yk7j=2F0lF5R4Ya58OUdA3gYIwrSviTFrn?= =?us-ascii?Q?lt8wNAN7qQOaERiJCMM+6aVCkPA+a1JBFBaYuOe?= =?us-ascii?Q?vUBlDm6iCBL98zPOtr2F7FUULtNqplIs8Tt7HTH?= =?us-ascii?Q?9XjiBkv8Y+S8eDgf8ZhCxzb307kB0zqB4sq+Om0?= =?us-ascii?Q?tLGwC0LEO7Z4we3uYGTabqrHcA=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: C4BZPJB2ZNADZ3ONFVNT6CYRZZTBKMLZ X-Message-ID-Hash: C4BZPJB2ZNADZ3ONFVNT6CYRZZTBKMLZ 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.3 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:117678] [Ruby master Feature#20444] Kernel#loop: returning the "result" value of StopIteration doesn't work when raised directly List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "ufuk (Ufuk Kayserilioglu) via ruby-core" Cc: "ufuk (Ufuk Kayserilioglu)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20444 has been updated by ufuk (Ufuk Kayserilioglu). @esad If you just want to return a result from the `loop`, you can use `break ` to do that: ``` $ ruby -e "puts loop { break 3 }" 3 ``` You shouldn't have to deal with anything low level like `StopIteration` to do that. ---------------------------------------- Feature #20444: Kernel#loop: returning the "result" value of StopIteration doesn't work when raised directly https://bugs.ruby-lang.org/issues/20444#change-108088 * Author: esad (Esad Hajdarevic) * Status: Feedback ---------------------------------------- There was a https://bugs.ruby-lang.org/issues/11498 a while ago which was merged in, but I was surprised to find out that raising `StopIteration` in a loop like `loop { raise StopIteration.new(3) }` returns nil and not 3. -- 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/postorius/lists/ruby-core.ml.ruby-lang.org/