[ruby-core:112808] [Ruby master Feature#19452] `Thread::Backtrace::Location` should have column information if possible.
From:
"ufuk (Ufuk Kayserilioglu) via ruby-core" <ruby-core@...>
Date:
2023-03-09 21:32:04 UTC
List:
ruby-core #112808
Issue #19452 has been updated by ufuk (Ufuk Kayserilioglu).
If memory increase is a concern, could we not store line/column information as varints (e.g. like [how Protocol Buffers encode integers](https://protobuf.dev/programming-guides/encoding/#varints)) in the bytecode, so that smaller numbers (which would be way more common, especially for column numbers) take up less memory to begin with? Since access to this data would probably not be on any hot-path, the fact that they'd have to be converted to regular ints when needed should be a very small concern.
----------------------------------------
Feature #19452: `Thread::Backtrace::Location` should have column information if possible.
https://bugs.ruby-lang.org/issues/19452#change-102311
* Author: ioquatix (Samuel Williams)
* Status: Open
* Priority: Normal
----------------------------------------
I discussed this with @mame and it would be pretty useful if we could also get the column information from exception backtrace location, even if it was slow.
A POC:
```ruby
class Thread::Backtrace::Location
if defined?(RubyVM::AbstractSyntaxTree)
def first_column
RubyVM::AbstractSyntaxTree.of(self, keep_script_lines: true).first_column
end
else
def first_column
raise NotImplementedError
end
end
end
```
It would be good to have a standard interface, so we follow the same interface as https://bugs.ruby-lang.org/issues/19451 and vice versa where it makes sense. I'll investigate it.
--
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/