[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: forcing userdata to be gc'd?
- From: Patrick Donnelly <batrick@...>
- Date: Sun, 2 Apr 2017 17:47:18 -0400
On Fri, Mar 31, 2017 at 6:14 PM, Gé Weijers <firstname.lastname@example.org> wrote:
> On Fri, Mar 31, 2017 at 12:24 PM, William Ahern <email@example.com>
>> Either Roberto or Luiz once proposed a construct that automatically
>> a __close metamethod on an object upon exiting a block. IIRC, it would be
>> invoked even if scope exit occured because an error was thrown.
>> I thought that was a cool idea. It's similar to the using, with, and defer
>> statements of other languages.
> It sometimes looks like this list is trying to reinvent Scheme one feature
> at a time. None of the above languages
> have coroutines (or it's Scheme cousin: call-with-current-continuation), and
> 'exit means exit'.
> Not so with coroutines, yield exits a block, but it may or may not return.
> If you're holding a lock using an RAII-style
> userdata you may be in trouble, either because after a resume you run your
> code without owning the lock, or the coroutine
> never gets resumed, and the lock is held way too long.
Uh, you'd be in trouble with coroutine yields regardless of the lock
management mechanism (RAII or just manual lock/unlock).
BTW, I find it unnecessarily passive aggressive to assert Lua et al.
are "reinventing" Scheme. It is the very nature of all (spoken and
artifical) languages to borrow (or steal) from each other. I don't go
out of my way to cite French whenever I pass out my resume (or spell
it to their standards for that matter).