Project

General

Profile

Actions

Bug #1573

closed

$0 behaves unexpectedly

Added by morris (M B) almost 15 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mswin32]
Backport:
[ruby-core:23717]

Description

=begin
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.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0