[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: state of the Lua nation on resource cleanup
- From: Fabien <fleutot+lua@...>
- Date: Tue, 17 Feb 2009 17:38:38 +0100
What's wrong with Joonas Pihlaja's proposal?
(Probably with a different syntax...)
do with f, g = io.open("src.txt","r"), io.open("dst.txt",w")
for l in f:lines() do
I've been using it in metalua for a while (syntax "with <var_list> = <values_list> do <scoped_statements> end") for some time, with the convention that the protected variables must have a ":close()" disposal method, and I'm pretty happy with it.