[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: gc problem when using lightuserdata to reference C++ objects
- From: "Javier Guerra" <javier@...>
- Date: Mon, 17 Nov 2008 10:07:40 -0500
On Mon, Nov 17, 2008 at 9:53 AM, Evan DeMond <evan.demond@gmail.com> wrote:
> You can always use do...end blocks to scope things the way you like it.
yep, but it's not really nice. imagine something like this:
unwinder(function ()
local fileone = open(.....)
yield (function() fileone.close() end)
.... do some stuff...
local otherresource = acquire(....)
yield (function() otherresource.release() end)
... still some more...
.... just finish
return whatever
end)
and the unwinder() would store the yield()'ed releaser functions in a
LIFO, and call them all when the main function finishes, be it
normally or with an error.
--
Javier