[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:04231] Re: getopt(s|long) and ARGF

From: Hugh Sasse Staff Elec Eng <hgs@...>
Date: 2000-07-27 08:40:53 UTC
List: ruby-talk #4231
On 26 Jul 2000, Dave Thomas wrote:

> Hugh Sasse Staff Elec Eng <hgs@dmu.ac.uk> writes:
> 
> > How do the getopt libraries interact with ARGF?  I know they can remove
> > things from ARGV, but will this mean that ARGF is affected at the same
> > time?  I'm not sure from the information I have found.
> 
> ARGF used ARGV whenever it needs to: it is evaluated lazily. What this 

I think that answeres my question.  So, when I fiddle with ARGV, the next
time I look at ARGF it will adjust itself accordingly.  That is better
than I had hoped, because I suspected it would be the first time I used it
which would set it up.

> means is that whenever you do a gets, ARGF says "do I have a file to

I'm using readlines, but I suppose the same thing applies.

> read from?" If not, it picks the next thing off ARGV and uses it. For
> example, here's som code that skips a file in the middle of ARGV.
	[lots of examples trimmed.]
> Hope this helps.

Yes, thank you.
> 
> 
> Dave
> 
> 
	Hugh
	hgs@dmu.ac.uk



In This Thread

Prev Next