ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "Eregon (Benoit Daloze) via ruby-core" <ruby-core@ml.ruby-lang.org>
To: ruby-core@ml.ruby-lang.org
Cc: "Eregon (Benoit Daloze)" <noreply@ruby-lang.org>
Subject: [ruby-core:119320] [Ruby master Feature#6012] Proc#source_location also return the column
Date: Fri, 27 Sep 2024 15:06:08 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-109934.20240927150607.59@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-6012.20120214091730.59@ruby-lang.org>

Issue #6012 has been updated by Eregon (Benoit Daloze).


It seems good to revisit this, the workarounds are pretty messy and CRuby-specific, e.g. https://github.com/rails/rails/pull/53055/files

I think @mame 's suggestion in https://bugs.ruby-lang.org/issues/6012#note-12 is fine although I think it would be convenient to also expose the byte offsets (start and end):
`.source_location #=> [path, start_line, start_column, start_offset, end_line, end_column, end_offset]`

Then it would be really easy to "get the source code of a Proc".
And of course we should do the same for Method/UnboundMethod (#8751).

----------------------------------------
Feature #6012: Proc#source_location also return the column
https://bugs.ruby-lang.org/issues/6012#change-109934

* 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/

       reply	other threads:[~2024-09-27 15:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-6012.20120214091730.59@ruby-lang.org>
2024-09-27 15:06 ` Eregon (Benoit Daloze) via ruby-core [this message]
2024-09-27 15:21 ` [ruby-core:119322] " Eregon (Benoit Daloze) via ruby-core
2025-01-05 14:05 ` [ruby-core:120485] " Eregon (Benoit Daloze) via ruby-core
2025-01-05 21:06 ` [ruby-core:120489] " bkuhlmann (Brooke Kuhlmann) via ruby-core
2025-01-09 11:26 ` [ruby-core:120566] " nobu (Nobuyoshi Nakada) via ruby-core
2025-01-09 11:51 ` [ruby-core:120572] " mame (Yusuke Endoh) via ruby-core
2025-01-09 14:31 ` [ruby-core:120576] " Eregon (Benoit Daloze) via ruby-core
2025-01-09 15:55 ` [ruby-core:120581] " Dan0042 (Daniel DeLorme) via ruby-core

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-109934.20240927150607.59@ruby-lang.org \
    --to=ruby-core@ml.ruby-lang.org \
    --cc=noreply@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).