3 ms·
> I always find it odd that the same developers who deride PHP look at things like IIFE and think "wow, JS is a cool, modern language!" I don't deride PHP (I d
by azakai 14y ago
> I always find it odd that the same developers who deride PHP look at things like IIFE and think "wow, JS is a cool, modern language!"
I don't deride PHP (I don't know it), but I see nothing wrong with IIFE. Yes, it could benefit from some syntactic sugar, but otherwise it is just using one of the best features of JavaScript, function support (first-class functions, anonymous functions, etc.).
It makes perfect sense to use a pattern like IIFE in order to encapsulate code, often using closures to allow access in a controlled manner from the outside, etc.
I suppose perhaps you don't like closures and so forth, and that's fine, but many people including me love them.
- ufo 14y agoIIFEs are cumbersome and non-intuitive. Better languages have block scope or a "let" statement instead.
- TazeTSchnitzel 14y ago`let` is drafted for ECMAScript 6.
- georgemcbay 14y ago...and ECMAScript 4 had block scope. Language design by committee is seriously flawed and until a feature is shipping in all the major browsers it isn't real.
- TazeTSchnitzel 14y agoECMAScript 4 was cancelled.
- georgemcbay 14y agoThat was exactly my point.
- grannyg00se 14y agoJavascript [does/will]* have a "let" statement. *depending on which version of ECMAscript is being used.