Bug #1573: $0 behaves unexpectedly
http://redmine.ruby-lang.org/issues/show/1573

Author: Morris Brodersen
Status: Open, Priority: Normal
Category: core
ruby -v: ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mswin32]

consider two files, foo.rb and bar.rb, both simply contain: "p $0". i run "ruby -rbar.rb foo.rb".

using 1.8.6 and the same setup, the output is:

"foo.rb"
"foo.rb"

using 1.9.1p0 the output is:

"ruby"
"foo.rb"

as a developer, i would expect the old (1.8.6) behavior. i've had arguments that the new behavior is more "correct", as there is no actual script running when the requiring of bar.rb takes place. however, from this correctness, there arises no advantage whatsoever. i am strongly in favor of the old behavior.


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