let expressions strawman
# David Herman (15 years ago)
f(let (a = getArray()) { if (x.length === 0) throw "empty array"; => a[0] })
erm, a.length. Like it matters. :)
f(let (a = getArray()) { if (x.length === 0) throw "empty array"; => a[0] })
erm, a.length. Like it matters. :)
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:
Read all about it here:
The proposal is short, but hopefully it gets the point across. I'd be more than happy to discuss it here. Comments most welcome!