- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Fri, 3 Apr 2009 13:44:55 -0500
On Thu, Apr 2, 2009 at 8:37 PM, Robert O'Callahan <robert at ocallahan.org> wrote: > I agree it would make sense for new APIs to impose much greater constraints > on consumers, such as requiring them to factor code into transactions, > declare up-front the entire scope of resources that will be accessed, and > enforce those restrictions, preferably syntactically --- Jonas' asynchronous > multi-resource-acquisition callback, for example. Speaking as a novice javascript developer, this feels like the cleanest, simplest, most easily comprehensible way to solve this problem. We define what needs to be locked all at once, provide a callback, and within the dynamic context of the callback no further locks are acquirable. You have to completely exit the callback and start a new lock block if you need more resources. This prevents deadlocks, while still giving us developers a simple way to express what we need. As well, callbacks are at this point a relatively novice concept, as every major javascript library makes heavy use of them. ~TJ
Received on Friday, 3 April 2009 11:44:55 UTC