[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Is breaking out of io.lines(file) safe?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 21 Mar 2011 10:09:42 -0300
> > Or simply leave it to the garbage collection. (More often than not there
> > is no hurry to close the file.)
>
> Hmm, until now it bit me twice not doing so (and doing business in C++
> I tend not to close files opened in function scope, leaving the work
> to the destructor).
>
> Look at the following simple example:
>
> [...]
I was talking about read-only streams, which is the case of a file
opened by io.lines.
-- Roberto