Alexander Jones (2015-05-14T19:09:29.000Z)
Yep, that's the reason. It's invalid with 'use strict' to put function
declarations inside an if or for block, and function declarations get
hoisted.

Alternatively, as we have object shorthand notation, e.g.

    {
        foo() {},
    }

that does not require the function keyword, yet still acts like a function,
expresses a property named foo that is a function with name property "foo".
So maybe in the same spirit we could also consider

    let foo() {};

But generators would look a bit weird without the function keyword...!

    let *foo() {}

Agree this is not exactly the most pressing issue, but it seems easy to
implement as it has trivial equivalence to existing language
(unforeseen grammar ambiguities notwithstanding!), and having to repeat the
name when defining scoped functions is a bit of a wart IMO.

Cheers


On Thursday, May 14, 2015, Andrea Giammarchi <andrea.giammarchi at gmail.com>
wrote:

> I guess 'cause that cannot be scoped, let's say in a for loop ... but
> yeah, I think that's not the most needed thing in the language right now,
> yet another shortcut with double reserved words one after the other
>
> Regards
>
> On Thu, May 14, 2015 at 7:45 PM, Kevin Smith <zenparsing at gmail.com
> <javascript:_e(%7B%7D,'cvml','zenparsing at gmail.com');>> wrote:
>
>> Why not use a function declaration instead?
>>
>> On Thu, May 14, 2015 at 2:37 PM Alexander Jones <alex at weej.com
>> <javascript:_e(%7B%7D,'cvml','alex at weej.com');>> wrote:
>>
>>> Propose adding support for
>>>
>>>     let function foo() {};
>>>
>>> which would have the equivalence of:
>>>
>>>     let foo = function foo() {};
>>>
>>> The idea is to support the normal scoping of let, but without forcing
>>> you to repeat yourself when naming the function, whilst still having the
>>> function's name property be set.
>>>
>>> This would trivially extend to const and var. Also, possibly class.
>>>
>>> Thanks
>>>
>>> _______________________________________________
>>> es-discuss mailing list
>>> es-discuss at mozilla.org
>>> <javascript:_e(%7B%7D,'cvml','es-discuss at mozilla.org');>
>>> https://mail.mozilla.org/listinfo/es-discuss
>>>
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> <javascript:_e(%7B%7D,'cvml','es-discuss at mozilla.org');>
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150514/add8b170/attachment.html>
d at domenic.me (2015-06-01T18:10:12.941Z)
Yep, that's the reason. It's invalid with 'use strict' to put function
declarations inside an if or for block, and function declarations get
hoisted.

Alternatively, as we have object shorthand notation, e.g.

    {
        foo() {},
    }

that does not require the function keyword, yet still acts like a function,
expresses a property named foo that is a function with name property "foo".
So maybe in the same spirit we could also consider

    let foo() {};

But generators would look a bit weird without the function keyword...!

    let *foo() {}

Agree this is not exactly the most pressing issue, but it seems easy to
implement as it has trivial equivalence to existing language
(unforeseen grammar ambiguities notwithstanding!), and having to repeat the
name when defining scoped functions is a bit of a wart IMO.