Issue #7436 has been updated by headius (Charles Nutter).


As a debugging feature I can support access to arbitrary. As a general, runtime, hot-path feature, there's numerous reasons why it's a terrible idea:

* It exposes all method-local state to *everyone*. Any library anywhere can not only access your local variables but modify them too. A potentially massive security hole.
* It requires that all method bodies everywhere in the system maintain all frame/scope state regardless of whether it's used or not, since "Binding.of_caller" style features could access it at any time.
* It drastically limits optimization potential for Ruby. On a good day, JRuby can be 10x or more faster than MRI largely because we've been able to eliminate framing/scoping overhead. A Binding.of_caller feature would severely damage our performance and very likely limit forever general Ruby performance.
----------------------------------------
Feature #7436: Allow for a "granularity" flag for backtrace_locations
https://bugs.ruby-lang.org/issues/7436#change-34574

Author: sam.saffron (Sam Saffron)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: next minor


related to http://bugs.ruby-lang.org/issues/7051

Sometimes one need less information (or more information) associated with backtraces.

It would be nice if one could send in a separate flag informing the VM about the granularity of information required, eg: 

caller_locations(0,-current_depth, BacktraceInfo::Label & BacktraceInfo::Lineno)

This allows for one to take quicker backtraces if they need less information, additionally BacktraceInfo::Bindings and BacktraceInfo::Klass could be added which allow you to gather more information for heavy profiling / diagnostics. 
 




-- 
http://bugs.ruby-lang.org/