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=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [IPv6:2a01:4f8:1c0c:6b10::1]) (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 5A45E1F44D for ; Wed, 17 Apr 2024 10:16:25 +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=cKraZanM; 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=l81OBmOC; dkim-atps=neutral Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 35708843B5; Wed, 17 Apr 2024 10:16:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1713348977; bh=Dv1Svqn7AFbuue0hdPyz9F63ILQO+BHXvFzmDeKjwkk=; 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=cKraZanMzINDSTnbn8MG97tDh1GkzLlZFg9K7BkG37Vooc/5AEHZKvdOCav0mj1b/ 8kKIr2T3S6+mhfe+vD4S0+E8LjbtZCxzLJsTAsXV4mqX7I6nKr0OrwS/w/AHydrtTY v9pQw8Ba8Gu/z4KA7fO7abjZVfrWvqTBjzmBnLQg= Received: from s.wfbtzhsv.outbound-mail.sendgrid.net (s.wfbtzhsv.outbound-mail.sendgrid.net [159.183.224.104]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 7D888843A9 for ; Wed, 17 Apr 2024 10:16:13 +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=l81OBmOC; 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=sSN5p+rRPi0emE1kb9B7I97ikuLtSxUVd4bDSC7J7GM=; b=l81OBmOCpHkZcI20XT9dv7mB1Pbj08aAWPUjvcTDd5K/K4H1IrO5mHi69Auioxq0cXNk u5cIyZ4lv/p5dhRJ0simuBuVGelEpHN8VUxfC5DEv/Em0n91/8NzUQy2AKrSQZvC76pjK3 S4Gj+FVNZoFGRObCSymX0B2T8JB7yw4baZnKD9Ldqh2L3KsEkdIzOFVKomvohv1ggaP+73 LtxuIMp34e+ODMFDy5/WNMCrwEfKfPv+M9IZ1C2X3CkNFk4yY0Z4jg5gTlqeAr1efiYqY2 revY1y/ogzBaXYQdbXWlnaLvwNYtzTOBUadXjmV98gAl0LO4payX5+DooPQS/m6Q== Received: by filterdrecv-5744f46764-mpl7q with SMTP id filterdrecv-5744f46764-mpl7q-1-661FA16C-3 2024-04-17 10:16:12.483813507 +0000 UTC m=+390489.141202633 Received: from herokuapp.com (unknown) by geopod-ismtpd-18 (SG) with ESMTP id CUez1kaZRKa8zDdNiYZnAw for ; Wed, 17 Apr 2024 10:16:12.406 +0000 (UTC) Date: Wed, 17 Apr 2024 10:16:12 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 20335 X-Redmine-Issue-Author: byroot X-Redmine-Issue-Priority: Normal X-Redmine-Sender: mame 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: 94153 X-SG-EID: =?us-ascii?Q?u001=2Ep+ckLDtT+4Y5c+H0YCkEnsuWiCQmn3OZA=2F9FzjoR6ZZlPaMv54M7EFoSM?= =?us-ascii?Q?CX5Trc79ep2R5F+0oYS4n23jq1cv+1tAJ1eax=2FP?= =?us-ascii?Q?WE7iXSu2JIJJwClpA7f=2FEqQCikFJlMwcFaMvBty?= =?us-ascii?Q?1+MSpbA9+lqYidbDXDtqRvraYOkvbZSIO52XsuT?= =?us-ascii?Q?=2FP+Hmtp0ai2KJ5MzKtgHw4HBXwTe0T6+XUcnQt+?= =?us-ascii?Q?GMDBmyghoXevZPsKIxtC9USmoKJCb2p8epqZm+O?= =?us-ascii?Q?3kReDdag3=2FZDzjxg=2FjMDbt1xrQ=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: XE2VZX2KBQK3AGLOBNZJ7XPE3MCZ6TVV X-Message-ID-Hash: XE2VZX2KBQK3AGLOBNZJ7XPE3MCZ6TVV 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:117557] [Ruby master Feature#20335] `Thread.each_caller_location` should accept the same arguments as `caller` and `caller_locations` List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "mame (Yusuke Endoh) via ruby-core" Cc: "mame (Yusuke Endoh)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20335 has been updated by mame (Yusuke Endoh). A little addition: the dicussion about length and range was considered (not ignored), but @matz said he didn't see the need to make it inconsistent with Kernel#caller and Kernel#caller_locations in this case. ---------------------------------------- Feature #20335: `Thread.each_caller_location` should accept the same arguments as `caller` and `caller_locations` https://bugs.ruby-lang.org/issues/20335#change-107955 * Author: byroot (Jean Boussier) * Status: Closed ---------------------------------------- `Thread.each_caller_location` was added to Ruby 3.2 as part of [Feature #16663] and is a very useful API for emitting warnings with a proper source location and similar use cases. However in many of the cases where I used it, or seen it used, it was needed to skip the first, or a couple frames: Examples: Sorbet: https://github.com/Shopify/sorbet/blob/b27a14c247ace7cabdf0f348bfb11fdf0b7e9ab4/gems/sorbet-runtime/lib/types/private/caller_utils.rb#L6-L18 ```ruby def self.find_caller skiped_first = false Thread.each_caller_location do |loc| unless skiped_first skiped_first = true next end next if loc.path&.start_with?("= 1 frames_to_skip -= 1 next end # snipp... ``` ### Proposal I think it would be very useful if `Thread.each_caller_location` accepted the same arguments as `caller` and `caller_locations`: ```ruby #each_caller_location(start = 1, length = nil) #each_caller_location(range) ``` @jeremyevans0 what do you 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/postorius/lists/ruby-core.ml.ruby-lang.org/