From: Thomas Sawyer <transfire@gmail.com>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:42951] [ruby-trunk - Feature #6012] Proc#source_location also return the column
Date: Sun, 26 Feb 2012 23:32:11 +0900 [thread overview]
Message-ID: <redmine.journal-24182.20120226233210@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-6012.20120214091730@ruby-lang.org
Issue #6012 has been updated by Thomas Sawyer.
Would this effect Method#source_location too?
I'm not sure I am really digging this idea. First of all it means I have to go back and fix some code. Secondly it means I have to always worry about the additional piece of data even though most of the time it doesn't matter. And if the return can vary between 2 or 3 elements that's another thing to worry with.
On the other hand I can understand that it could be useful information in some cases.
In times like this that I think "Embrace the Object".
proc.source_location #=> #<SourceLocation @file="foo.rb" @line=12 @column=14>
And then a few different methods could provide that information in various useful forms.
proc.source_location.to_a #=> ["foo.rb", 12, 14]
proc.source_location.to_s #=> "foo.rb:12"
proc.source_location.values_at(:file, :line) #=> ["foo.rb", 12]
Or what have you.
----------------------------------------
Feature #6012: Proc#source_location also return the column
https://bugs.ruby-lang.org/issues/6012
Author: Roger Pack
Status: Open
Priority: Normal
Assignee: Nobuyoshi Nakada
Category: core
Target version: 2.0.0
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-
--
http://bugs.ruby-lang.org/
next prev parent reply other threads:[~2012-02-26 14:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-14 0:17 [ruby-core:42579] [ruby-trunk - Bug #6012][Open] Proc#source_location also return the column Roger Pack
2012-02-14 0:18 ` [ruby-core:42580] [ruby-trunk - Bug #6012] " Roger Pack
2012-02-25 20:06 ` [ruby-core:42928] [ruby-trunk - Feature " Koichi Sasada
2012-02-26 14:32 ` Thomas Sawyer [this message]
2012-02-26 14:33 ` [ruby-core:42952] " Thomas Sawyer
2012-02-26 20:18 ` [ruby-core:42961] " Eric Hodel
2012-02-27 0:39 ` [ruby-core:42964] " Thomas Sawyer
2012-02-27 0:40 ` [ruby-core:42965] " Thomas Sawyer
2012-10-25 12:58 ` [ruby-core:48281] " yhara (Yutaka HARA)
2018-12-28 6:05 ` [ruby-core:90769] [Ruby trunk Feature#6012] " mame
2019-01-20 22:14 ` [ruby-core:91197] " samuel
2019-02-12 1:24 ` [ruby-core:91512] " samuel
2019-02-12 2:24 ` [ruby-core:91514] " samuel
2019-02-12 7:49 ` [ruby-core:91518] " duerst
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-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-24182.20120226233210@ruby-lang.org \
--to=ruby-core@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 read-only IMAP folder(s) and NNTP newsgroup(s).