Surprise? ARGV[0] undefined after processing ARGF

I found this behavior surprising. Is it
intentional (and therefore something I need
to understand better), or is it a bug:

     print_usage if ARGV[0] == nil
     puts ARGV[0] # => filename

     # Parse the document
     @doc = Document.new ARGF.read()
     puts ARGV[0] # => nil

Hi,

···

In message "Re: Surprise? ARGV[0] undefined after processing ARGF" on Thu, 22 Jun 2006 10:19:00 +0900, Eric Armstrong <Eric.Armstrong@Sun.COM> writes:

I found this behavior surprising. Is it
intentional (and therefore something I need
to understand better), or is it a bug:

Intentional. Processed file names are removed from ARGV to tell you
how far you have done already.

              matz.

Ok.
Thanks.

Yukihiro Matsumoto wrote:

···

Hi,

In message "Re: Surprise? ARGV[0] undefined after processing ARGF" > on Thu, 22 Jun 2006 10:19:00 +0900, Eric Armstrong <Eric.Armstrong@Sun.COM> writes:
>I found this behavior surprising. Is it
>intentional (and therefore something I need
>to understand better), or is it a bug:

Intentional. Processed file names are removed from ARGV to tell you
how far you have done already.

              matz.