- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Wed, 12 Jan 2011 10:28:25 -0800
- To: Jonas Sicking <jonas@sicking.cc>
- Cc: Keean Schupke <keean@fry-it.com>, Jeremy Orlow <jorlow@chromium.org>, robert@ocallahan.org, Glenn Maynard <glenn@zewt.org>, Charles Pritchard <chuck@jumis.com>, public-webapps WG <public-webapps@w3.org>
On Tue, Jan 11, 2011 at 11:48 PM, Jonas Sicking <jonas@sicking.cc> wrote: > On Tue, Jan 11, 2011 at 6:02 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote: >> Lisp has, for example, macros like WITH-HASH-TABLE-ITERATOR, which >> takes a hash, a name for the iterator to be produced, and then a chunk >> of code within which the iterator is available. >> >> Python has its "with" keyword, used like "with file = open('foo'): >> doStuffToTheFile(file)", which similarly creates a named resource and >> takes a chunk of code within which the resource is available. I know >> that other languages have similar, but off the top of my head I'm >> having trouble thinking of them. > > All of these seem very similar to the 'with' operator in javascript, > but quite different from a function which registers a asynchronous > callback. Huh. We must be slicing our abstractions differently. Neither of these seem particular close to javascript's "with" to me, and both seem very close to the "withNamedStorage" idea. Are you hung up on the use of a callback versus explicit syntax support? That's a very unimportant distinction, and is merely a byproduct of a language explicitly supporting something with syntax or not. Lisps's example isn't even "officially supported with syntax", it's just that the syntax is simple and hackable so you can't tell the difference. ~TJ
Received on Wednesday, 12 January 2011 18:29:19 UTC