From: "Eregon (Benoit Daloze) via ruby-core" Date: 2025-12-16T10:16:23+00:00 Subject: [ruby-core:124232] [Ruby Feature#6012] Proc#source_location also return the column Issue #6012 has been updated by Eregon (Benoit Daloze). mame (Yusuke Endoh) wrote in #note-32: > I record the summary of the discussion regarding Matz's decision to revert this for now. The decision was based on a combination of several reasons: Thank you for documenting that. It feels to me like the decision was taken while we were in the middle of discussing https://bugs.ruby-lang.org/issues/21783, where we seem to now have reached an agreement, but the revert decision (and revert PR merged) was taken without any time for me to even reply there. > * Unclear use cases The fact many issues have been filed about this seems to show this is clearly a wanted feature. It has always been useful to find where a method/block is defined. https://rubygems.org/gems/method_source has 700 millions downloads, what other proof do we need? > * Difficulty in changing `Binding#source_location` (#6012#note-24, #21005#note-19) I wasn't aware of these, but I think this is much less needed than on {Proc,Method,UnboundMethod}. Unless I'm missing something, a Binding doesn't always have a properly-defined source location/definition, e.g. for `b = binding`. It has a start line if we consider that to be at the line of the `binding` call, but not really an end line/column. IOW it's not a "scope" unlike a method or block, and seems much less useful. > * Related issues: > * We may need to adjust Proc#source_location's position (#21784). > * We need to discuss column units (bytes vs characters) (#21783). I'm fixing both of these in https://github.com/ruby/ruby/pull/15580. Both issues seem to have rather clear agreements at this point. > * Timing: We can still revert without compatibility issues at this point. The feature has been implemented since 9th January, almost a year ago. It's not been in a proper release yet of course but it has been in multiple previews. I'm not sure if other people have tried it already, but I'm pretty confident a bunch of people are gonna be disappointed if this is removed last minute and it needs another year before it's in a Ruby release. Do we really want to encourage heuristics like https://bugs.ruby-lang.org/issues/20999#note-1 vs a proper a solution by providing the necessary information in `{Method,UnboundMethod,Proc}#source_location`? ---------------------------------------- Feature #6012: Proc#source_location also return the column https://bugs.ruby-lang.org/issues/6012#change-115718 * Author: rogerdpack (Roger Pack) * Status: Open * 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/