let expressions strawman

# David Herman (15 years ago)

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!

# David Herman (15 years ago)

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

erm, a.length. Like it matters. :)