IIAFEs?

Quildreen Motta quildreen at gmail.com
Thu Jun 20 13:06:49 PDT 2013


On 1 June 2013 20:52, Jorge <jorge at jorgechamorro.com> wrote:

> On 02/06/2013, at 01:22, Brandon Benvie wrote:
> > On 6/1/2013 3:44 PM, Jorge wrote:
> {
>   block: {
>     if (true) {
>       break block;
>     }
>   }
> }
>
> But then... I'm not sure this is any better than an IIFE!
>
>
Anything is better than an "Immediately Invoked Function-silly-Expression",
actually. The only reasonable use for that is to create a new scope in the
context of a statement:

void function() {
  doSomething()
}()

Block scoping/let makes this pattern completely unecessary. As for the
other arguments, you do not wrap a function expression in parenthesis,
they're already expressions so there's no need for that. At any rate, the
problem here is JavaScript's usage of statements instead of Expressions,
Expressions Everywhere.

e.g.:

var x = function(){ return foo }()




-- 
--
Quildreen "Sorella" Motta  (http://killdream.github.com/)
*— JavaScript Alchemist / Minimalist Designer / PLT hobbyist —*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130620/39bf845e/attachment.html>


More information about the es-discuss mailing list