Function Syntax

Dean Landolt dean at deanlandolt.com
Wed May 11 09:59:33 PDT 2011


On Wed, May 11, 2011 at 12:46 PM, David Herman <dherman at mozilla.com> wrote:

> Evidence is good, but that's not exactly scientific. In particular, I'd
> wager there's a material difference in this phenomenon between a language in
> which *all* functions implicitly return and one in which this is only the
> case for a specific convenience form.
>
> That said, we could also consider a variant that forces the function to
> return undefined. (For a semi-concrete example, the 'void' keyword might fit
> in the surface syntax somewhere.)
>


It fits nicely today:

    void (function() { return 1 })() == null // true

That reads just as well with a sugared function/return, I'd wager. JSLint
could even be configured to require it :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110511/1394a282/attachment.html>


More information about the es-discuss mailing list