From: Peter Hickman Date: 2002-07-08T22:05:34+09:00 Subject: Re: How to determine EOF with sysread? Austin Ziegler wrote: >On Mon, 8 Jul 2002 14:47:25 +0900, Sean Chittenden wrote: > >>>Thanks all for the answers. Does it strike anyone as bad practice >>>to use a rescue for control flow? I thought a more explicit test >>>method would have been provided. >>> >>My C roots tell me, yes, but my Ruby roots tell me no. Having an >>exception thrown/caught is okay practice in Ruby. >> > >It still seems wrong to me, since an end of file condition is an >expected situation, not an exceptional situation. > >*shrug* > >-austin >-- Austin Ziegler, austin@halostatue.ca on 2002.07.08 at 08.39.15 > But eof is the exception when reading a file, because a read will usually succeed. This sort of thing is used a lot on VAXes (if they still exist) and early mini / mainframe designs. I expect programs to have bugs, but I can't predict what and where or I would have written the program differently. Therefore they are exceptions even though they are expected.