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) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id F2EFD1F5CB for ; Fri, 27 Sep 2024 15:22:03 +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=H1+0Svvw; 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=k3tHXwAW; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1727450490; bh=QWBdQPEnlE/7/TauQfPUvNMILdJfLhiiY90o9lol9Ac=; 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=H1+0SvvwA23umZhJL1HSrRatbuuvv0gZgS+h0EE1am/VaCdXEkSldXfPSPV3JTPI+ y+RT9uSaDCKIWld4PH8o+NbuB4Tuimnz9fSjW4Ug+TyEtq4PoEp3ML8MVvLpevd11q Krvri0JdThd9UOmfaEdYX6hJRXRaZ7MnyFBNGAWc= Received: from nue.mailmanlists.eu (localhost [IPv6:::1]) by nue.mailmanlists.eu (Postfix) with ESMTP id C79B643F5F for ; Fri, 27 Sep 2024 15:21:30 +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=k3tHXwAW; dkim-atps=neutral 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 BE85743ED5 for ; Fri, 27 Sep 2024 15:21:18 +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=JFv40lO60EPChlH8OwESaBFzM6O39HtQg/FWakf+Pd0=; b=k3tHXwAWaTq/AXmyD8xr8Q3QIfQX7gYgEuNt+IOvgkNwBX0lVndUrjQR0Nt3a4GQAqPK TSXmHXIElTjxTomfelI+wZIsFzgfIlP35qrrLrFp5lYUJOGE57T8lXqjeT9vsWLHY0ZG0+ Ce+vwe+aKvRUMhbRhQcu/gbsrRZZn8BrmZTUDA83LaYFf8ub16PfalQCjueww1ipZqhz+h qGiN46abKaGfIFGwZkjV9zsehtvSQeudkIXzf62JP43YCI4Vuvml5X5Sl13LjH8293m/zG hunlJ1VdfAGUdYqLKPm+4JwNUVKYW1uTC5hvAwzGZGQKWIwygEMgwHs+dXQgMM3g== Received: by recvd-55fc7fd858-p884p with SMTP id recvd-55fc7fd858-p884p-1-66F6CD6B-48 2024-09-27 15:21:15.973124401 +0000 UTC m=+1286632.838777156 Received: from herokuapp.com (unknown) by geopod-ismtpd-10 (SG) with ESMTP id UlwK_UoMSO20I1m4HtGk1w for ; Fri, 27 Sep 2024 15:21:15.832 +0000 (UTC) Date: Fri, 27 Sep 2024 15:21:15 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 6012 X-Redmine-Issue-Author: rogerdpack X-Redmine-Issue-Assignee: nobu X-Redmine-Issue-Priority: Normal 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-Redmine-MailingListIntegration-Message-Ids: 95957 X-SG-EID: =?us-ascii?Q?u001=2EByjZWvxTCjdoV8K03xEuhE7KqN4thWULFLM7+oH78KY30oYB3qFthsDpL?= =?us-ascii?Q?4w4cbYa3ttBh8bAHPOnE=2FkzPba67JNu7Lnrked2?= =?us-ascii?Q?O7K9VQ=2FJax0zSmJre=2FjaR7x1kd8t7Ta4XDHR8lW?= =?us-ascii?Q?LuBx607E9n=2FbDhDYXQmhnoI30YKf=2F2bfS765mwL?= =?us-ascii?Q?wdxQTMd0QOAPh65c0qFUy=2F1l5iOT2ZhDhCSCxlQ?= =?us-ascii?Q?kIc4vT9Glj0qn=2F1SqXeO3VxGAD8=2FABzbfovrVan?= =?us-ascii?Q?2iUS4PY=2F2UctuFev5kjOddiHfw=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: EW7CZPWFUX77SGX3Z52NJOH6QEON46EX X-Message-ID-Hash: EW7CZPWFUX77SGX3Z52NJOH6QEON46EX 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:119322] [Ruby master Feature#6012] Proc#source_location also return the column List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "Eregon (Benoit Daloze) via ruby-core" Cc: "Eregon (Benoit Daloze)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #6012 has been updated by Eregon (Benoit Daloze). I also really like @ioquatix 's suggestion in https://bugs.ruby-lang.org/issues/6012#note-13 and it is a lot more flexible and more efficient too (since computing e.g. column information if unused is not cheap). For instance `method.source.code` is great because it completely hides the details how to get the source code and slice it. TruffleRuby currently keeps the source code in memory and so could provide this automatically without needing to reread the file from disk. CRuby keeps it but only if `RubyVM.keep_script_lines = true`, so then could use that if available and automatically fallback to read the file from disk (great, because we should avoid users/gems referring to `RubyVM` in their code). One question is where would we place/how would we name this class? We could reuse `Thread::Backtrace::Location` as it's quite similar and already has `path`, `lineno`. But it's not really related to a backtrace here. Still it seems quite a good fit, and I don't have much idea where to place it otherwise (top-level `Source` seems way too prone for conflicts). I think in term of the interface we should have: * start_line * start_column * start_offset * end_line * end_column * end_offset * code: gets the source of the Proc/Method/UnboundMethod ---------------------------------------- Feature #6012: Proc#source_location also return the column https://bugs.ruby-lang.org/issues/6012#change-109936 * Author: rogerdpack (Roger Pack) * Status: Assigned * Assignee: nobu (Nobuyoshi Nakada) ---------------------------------------- As originally suggested in http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/42418 Suggestion/feature request: have #source_location also return the beginning column where it was defined. ["test.rb", 8, 33] Thanks! -roger- -- 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/