function hoisting like var

Ingvar von Schoultz ingvar-v-s at
Fri Jul 25 19:03:16 PDT 2008

Igor Bukanov wrote:
> I guess that proposal can be summarized in a very short form:
> make
>   {{ code }}
> a syntax sugar for
>   (function() { code })()

Indeed you're right.

When I proposed {{ }} my intent was simplicity, but I didn't
realize that implementing it could be made that simple, the
change that small.

By the way, your translation

     (function() { code })()

can also be expressed as

     new function() { code }

Less parentheses!

(But I haven't explored possible drawbacks.)

Ingvar von Schoultz

------- (My quirky use of capitals in code comes from my opinion that
reserved and predefined words should all start with lowercase, and
user-defined should all start with uppercase, because this will easily
and elegantly prevent a host of name-collision problems when things
like programming languages are upgraded with new labels.)

More information about the Es4-discuss mailing list