[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: 5.1 beta and closing files
- From: Klaus Ripke <paul-lua@...>
- Date: Mon, 21 Nov 2005 16:04:36 +0100
On Mon, Nov 21, 2005 at 12:51:25PM -0200, Roberto Ierusalimschy wrote:
> > This means that code like this (from luasocket)
> >
> > a,b,c= h.request{url="http://www.acme.com/index.html",sink=
> > ltn12.sink.file(io.stdout)}
> >
> > will close stdout in 5.1 whereas in 5.0.2 it did not.
>
> I may be wrong, but I think a library function should not close a file
> that it did not open.
It is common and handy for such wrappers to be able to
finally close their files, as they usually have the only
reference, and file close should not be deferred to the gc.
> > Would it be possible to have [...] an io flag that sets the old behaviour?
But probably the wrapper should have such a flag.
cheers