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 2794D1F487 for ; Sun, 2 Mar 2025 22:18:31 +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=eUDcW4Xp; 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=ie52Svri; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1740953908; bh=wQ/KWXlC/nr+VWrHh/tr32MrLuLnqtXRKjefETmgmaU=; 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=eUDcW4XpMmvhHf7oqqls5weo+N4ztcjCwem3VpZnC6rAmCSENi3VgFnVrOsoh8ERR DZ9KmlDT8cCMpPlnxQ7rf/gkAPpiTJZjkigAOMJrdiUZw1n4mYQQOd6l7w5caxWx9t lg9AHX1mxbwqhlI6m8BLeqoP++U2wOGl+djBQ2cs= Received: from nue.mailmanlists.eu (localhost [IPv6:::1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 1375646AA8 for ; Sun, 2 Mar 2025 22:18:28 +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=ie52Svri; dkim-atps=neutral Received: from s.wrqvtvvn.outbound-mail.sendgrid.net (s.wrqvtvvn.outbound-mail.sendgrid.net [149.72.120.130]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 7CE6446A94 for ; Sun, 2 Mar 2025 22:18:22 +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=UB985nsGyXiUrnZJbAO2gN6VHH5IPkQwR9lSEAtHMbk=; b=ie52SvricYqGzcLGxZA76jOlst14jN9QMb5DOGgMEZD2chzdV7ujxLKTUtaHOqzHEpAO G6PXgOel3KRQ4rofr6PaMVk8Wux9+ljzS/kll35jcxFCnQ39bAz5N3DL8O2LsfqZW9qrqR yEa4c4EuS2rtUOXKJgkWFzQwcKMwEHcz5AjPVX11fZFeqfA+xwgM+9l7HjIyq6rThVS/48 a91nZ7tF2IUuRLVwcoJ+UNww83tf9o/JbUWITh7cy9h0c3naZC4mTc3N5BE3w6JIpIFOiw zodBZKpYA0TGJ3HA2+EWexOEBIWpKL4twLqqPulVGpceGjTlK0fHkYaUucYTZQbg== Received: by recvd-69fb75db69-vk8lv with SMTP id recvd-69fb75db69-vk8lv-1-67C4D92C-48 2025-03-02 22:18:20.899078422 +0000 UTC m=+963611.651095489 Received: from herokuapp.com (unknown) by geopod-ismtpd-39 (SG) with ESMTP id 2OnPNLnYRbChPyyXwKBrbw for ; Sun, 02 Mar 2025 22:18:20.847 +0000 (UTC) Date: Sun, 02 Mar 2025 22:18:20 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Misc X-Redmine-Issue-Id: 20968 X-Redmine-Issue-Author: koic X-Redmine-Issue-Priority: Normal X-Redmine-Sender: ioquatix 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: 97940 X-SG-EID: =?us-ascii?Q?u001=2E3QFJPY5gaRwyNXkncYONHM3OeFnb=2FgeOrLDgg3PYIKrq5rvk81iAipQ1q?= =?us-ascii?Q?cdmuT9o5PIWGjXtTDstodNmslT=2F6xfCuIofWR2K?= =?us-ascii?Q?w8msDgVaVLyOIx2MUgbG87Wdx4KDUpn3SOmQQuB?= =?us-ascii?Q?Na9Ku17597g2gyKv+nrMsx=2FLGXwExXm1nUwfCXr?= =?us-ascii?Q?J3=2Fm8+UNZ=2FvQeHB0Wr1Ys6DRsZfnPVLeC9FvKbq?= =?us-ascii?Q?TxckeeiVU8j+w8G7o92x9GdiLRuR1X1SJK8=2FOp9?= =?us-ascii?Q?Luc957JtrraBI39CG=2FISZmQ4Rw=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: WCFL5QZNAF4XH6GDIIFGWKA2FDMLT6N6 X-Message-ID-Hash: WCFL5QZNAF4XH6GDIIFGWKA2FDMLT6N6 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:121216] [Ruby master Misc#20968] `Array#fetch_values` unexpected method name in stack trace List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "ioquatix (Samuel Williams) via ruby-core" Cc: "ioquatix (Samuel Williams)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20968 has been updated by ioquatix (Samuel Williams). I also agree this is not a bug and the expanded stack trace is good. But let me talk about my experience with Objective-C. A long time ago, I created Objective-C applications with Apple's Cocoa framework. It uses "delegate" pattern extensively which are essentially callbacks wrapped in objects with a well defined interface. In particular, Apple's frameworks were soemtimes buggy, but using adebugger, all the intermediate stack traces are hidden. So a stack trace (or thread backtrace) would show something like: ``` ``` This made debugging EXTREMELY difficult because it was impossible to figure out what the expectations of the `` were - no way to correlate it back to code or even inspect what was going on. Now, back to Ruby. I greatly prefer visibility in the stack trace. If something goes wrong (usual cause of exception with backtrace), even if it was the user code that made a mistake (e.g. the implementation of `hash` or something invoked by the internal code), it can be extremely helpful if the user can easily find that code in order to read it and debug their own code. This difficulty with Objective-C was one of the reasons I eventually stopped using it - the frameworks were too opaque and it made debugging extremely painful. ---------------------------------------- Misc #20968: `Array#fetch_values` unexpected method name in stack trace https://bugs.ruby-lang.org/issues/20968#change-112157 * Author: koic (Koichi ITO) * Status: Open ---------------------------------------- It seems that the current Ruby implementation is displaying unexpected method name in stack trace. ## Expected Similar to `Hash#fetch_values`, the method name `Array#fetch_values` is expected to be displayed in the stack trace. ```console $ ruby -e '{k: 42}.fetch_values(:unknown)' -e:1:in 'Hash#fetch_values': key not found: :unknown (KeyError) from -e:1:in '
' $ ruby -e '[1].fetch_values(42)' -e:1:in 'Array#fetch_values': index 42 outside of array bounds: -1...1 (IndexError) from -e:1:in '
' ``` ## Actual The stack trace displays the `Array#fetch` method, which user is not aware of, along with the `` stack trace. ```console $ ruby -e '[1].fetch_values(42)' :211:in 'Array#fetch': index 42 outside of array bounds: -1...1 (IndexError) from :211:in 'block in Array#fetch_values' from :211:in 'Array#map!' from :211:in 'Array#fetch_values' from -e:1:in '
' ``` It likely requires an approach such as implementing it in C, as suggested in https://github.com/ruby/ruby/pull/11555. -- 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/