Hi,
How would this:
(Function () {
// ...
})();
now look like with arrow functions?
(()={
// ...
})();
What can be left out, if anything?
Thank you,
--
( Jorge )();
___
es-discuss mailing list
es-discuss@mozilla.org
s/Function/function/g
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
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
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
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,
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,
On 01/06/2013, at 23:57, François REMY wrote:
Arrow functions probably shouldn’t be used for this, this is not very
readable.
Yeah, arrow functions are grawlix-y per se, but I've come to admit that Brendan
(et al) was (were) right: they're going to be a Good Part™.
I think you should have
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
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*
Based on my understanding of modules ( so this may well be wrong )
where you want to use the module you would write
import someThing from mymodulefile
and inside mymodulefile.js, the file that exports the resource you
want to use, you would do
function someThing(){}
export someThing;
and
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
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:
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?
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
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
15 matches
Mail list logo