return when desugaring to closures

Jon Zeppieri jaz at bu.edu
Sat Oct 11 15:53:58 PDT 2008


On Sat, Oct 11, 2008 at 6:38 PM, Mark S. Miller <erights at google.com> wrote:
> On Sat, Oct 11, 2008 at 3:25 PM, Jon Zeppieri <jaz at bu.edu> wrote:
>> [...]  I'd just like a
>> non-hoisting 'let.'  Based on what you wrote about hoisting earlier in
>> this thread, I'm surprised you don't want one, too.
>
> History aside, my preference would be what E does: A variable is in
> scope textually starting at the point of declaration, left-to-right,
> until the close of its enclosing scope block. I would love it if this
> applied to lets, consts, and functions. However, given that ES3
> functions hoist (within the top-level function body), I think the
> least surprising least asymmetric compromise is to generalize
> functions to be per-block, and to have const and let scope like
> functions will.

I agree.  The let declaration has to hoist, or else it isn't the new
var, and then we'll have to throw out all those tee shirts.  That's
why I want a let block.  (Actually, as I posted some time ago, I'd
prefer to have the let block *instead* of the let declaration, but I
realize that's a non-starter with most of the TC members.)


More information about the Es-discuss mailing list