Won wonchun at gmail.com
Tue Jul 31 12:49:08 PDT 2007

Greetings (my first post) --

I'm pretty excited about the proposed changes coming up for
ECMAscript. "let" in particular seems overdue. For better or worse, I
have a C++ programming background, and one of the idioms that I find
useful every day is RAII (resource acquisition is initialization),
also called the "Dispose" pattern in other languages. When a variable
falls out of scope (say, an object that contains a file handle), then
a method gets called (e.g. close file handle). In particular, RAII
makes exception-safe coding much more convenient.

In C++, every object gets this treatment. Other languages have special
syntax/forms, such as "using" in C#, "with" in Python and VB, and
Ruby/Smalltalk has variables scoped in closure blocks.

Some more info can be found here:

So I skimmed the wiki and the es4-discuss mailing list archives, and
didn't notice any references to RAII. Is it possible to extend the
behavior of "let" to support RAII?


More information about the Es4-discuss mailing list