let expressions strawman

David Herman dherman at mozilla.com
Tue Apr 6 18:59:38 PDT 2010


Dear all,

We've talked about various let-binding forms in the past, and the let-declaration form has pretty wide support. The other two forms proposed for ES4 were more controversial. I've just posted a small strawman proposal for let expressions that brings this down to just one additional form, and ends up being more useful to boot-- you can *both* execute statements *and* produce a result value. A quick example:

    f(let (a = getArray()) {
          if (x.length === 0)
              throw "empty array";
          => a[0]
      })

Read all about it here:

    http://wiki.ecmascript.org/doku.php?id=strawman:let_expressions

The proposal is short, but hopefully it gets the point across. I'd be more than happy to discuss it here. Comments most welcome!

Dave



More information about the es-discuss mailing list