Re: IIAFEs?

2013-06-20 Thread Quildreen Motta
On 1 June 2013 20:52, Jorge jo...@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

Re: IIAFEs?

2013-06-20 Thread Chris Ryan
Hi, sorry if this is tangentially related to the conversation, however I've just got a simple question. How would you call eval() with the ThisBinding inside the evaluated code being a custom item? In ES5 we'd do something like the following: (function () { eval(foo); }).call(bar);

Re: IIAFEs?

2013-06-02 Thread Petter Envall
2013/6/2 David Bruant bruan...@gmail.com Good points, thanks! Le 01/06/2013 21:10, Petter Envall a écrit : 2013/6/2 David Bruant bruan...@gmail.com Le 01/06/2013 16:52, Jorge a écrit : On 02/06/2013, at 01:22, Brandon Benvie wrote: On 6/1/2013 3:44 PM, Jorge wrote: But they're not

Re: IIAFEs?

2013-06-02 Thread David Bruant
Le 01/06/2013 23:14, Petter Envall a écrit : Re In this language, I'm not aware of other languages where you need to concatenate code. It has become a good practice for perf on the web as a workaround of HTTP 1.x limitations. HTTP 2 promises that with multiplexing, script

Re: IIAFEs?

2013-06-01 Thread Jorge
s/Function/function/g ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: IIAFEs?

2013-06-01 Thread Axel Rauschmayer
You’ll rarely, if ever, need IIFEs with ES6, thanks to block-scoped function declarations and for-of (which creates a fresh copy of the iteration variable for each iteration). Thus, instead of: (function () { var tmp = …; }()); you can do: { let tmp = …; } I’d still love to have

RE: IIAFEs?

2013-06-01 Thread François REMY
Arrow functions probably shouldn’t be used for this, this is not very readable. I think you should have a look at modules, this is what is expected to replace this pattern ;-) From: jo...@jorgechamorro.com Subject: IIAFEs? Date: Sat, 1 Jun 2013

Re: IIAFEs?

2013-06-01 Thread Jorge
On 01/06/2013, at 23:49, Axel Rauschmayer wrote: On Jun 1, 2013, at 14:38 , Jorge jo...@jorgechamorro.com wrote: How would this: (Function () { // ... })(); now look like with arrow functions? (()={ // ... })(); What can be left out, if anything? You’ll rarely,

Re: IIAFEs?

2013-06-01 Thread Axel Rauschmayer
But they're not fully interchangeable, No, they aren’t. for example I can exit a function at any point with a return, but can I exit a block at any point with a break or something? You can give the block a label, say, `foo` and then exit via `break foo`. Also a function returns a value,

Re: IIAFEs?

2013-06-01 Thread Brandon Benvie
On 6/1/2013 3:44 PM, Jorge wrote: But they're not fully interchangeable, for example I can exit a function at any point with a return, but can I exit a block at any point with a break or something? block: { if (true) { break block; } } Also a function returns a

Re: IIAFEs?

2013-06-01 Thread Jorge
On 02/06/2013, at 01:12, Axel Rauschmayer wrote: for example I can exit a function at any point with a return, but can I exit a block at any point with a break or something? You can give the block a label, say, `foo` and then exit via `break foo`. So should I break to a label *outside*

Re: IIAFEs?

2013-06-01 Thread Jorge
On 02/06/2013, at 01:22, Brandon Benvie wrote: On 6/1/2013 3:44 PM, Jorge wrote: But they're not fully interchangeable, for example I can exit a function at any point with a return, but can I exit a block at any point with a break or something? block: { if (true) { break

Re: IIAFEs?

2013-06-01 Thread Brandon Benvie
On 6/1/2013 4:52 PM, Jorge wrote: What might happen with this is that if you concatenate a bunch of .js files that use this pattern, they might end redefining the same label (which would be an error, I guess). You can only break a block that you're currently in. So this is fine: block:

Re: IIAFEs?

2013-06-01 Thread David Bruant
Le 01/06/2013 16:52, Jorge a écrit : On 02/06/2013, at 01:22, Brandon Benvie wrote: On 6/1/2013 3:44 PM, Jorge wrote: But they're not fully interchangeable, for example I can exit a function at any point with a return, but can I exit a block at any point with a break or something?

Re: IIAFEs?

2013-06-01 Thread Petter Envall
2013/6/2 David Bruant bruan...@gmail.com Le 01/06/2013 16:52, Jorge a écrit : On 02/06/2013, at 01:22, Brandon Benvie wrote: On 6/1/2013 3:44 PM, Jorge wrote: But they're not fully interchangeable, for example I can exit a function at any point with a return, but can I exit a block at

Re: IIAFEs?

2013-06-01 Thread David Bruant
Le 01/06/2013 21:10, Petter Envall a écrit : 2013/6/2 David Bruant bruan...@gmail.com mailto:bruan...@gmail.com Le 01/06/2013 16:52, Jorge a écrit : On 02/06/2013, at 01:22, Brandon Benvie wrote: On 6/1/2013 3:44 PM, Jorge wrote: But they're not fully