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


Maybe another angle for this would be to make the `instance variable @foobar not initialized` shown even with the default `$VERBOSE` being `false` (i.e. `rb_warn` instead of `rb_warning`).
Then people would likely be a lot more eager to fix it.

It can be advantageous for performance to have ivars always initialized when reading them, otherwise there is some kind of polymorphism introduced (i.e., executed when the ivar doesn't exist and executed when the ivar exists).

----------------------------------------
Feature #16855: Add a tracepoint for warnings
https://bugs.ruby-lang.org/issues/16855#change-85599

* Author: tenderlovemaking (Aaron Patterson)
* Status: Rejected
* Priority: Normal
----------------------------------------
I would like to add a tracepoint for warnings.  I want to do this so that DidYouMean can suggest fixes for instance variables.  I noticed did you mean [has experimental support](https://github.com/ruby/did_you_mean/blob/master/lib/did_you_mean/experimental/ivar_name_correction.rb), but it looks very complicated.  I think if we added a tracepoint for such warnings, DidYouMean can provide more helpful warnings.

I made a pull request [here](https://github.com/ruby/ruby/pull/3106)



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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>