3 ms·
Fine but its dangerous. Javascript/Ecmascript, is a poor designed language, the scope of the variables is broken. Instead, PHP is well defined in this aspect
by jorgec 9y ago
Fine but its dangerous. Javascript/Ecmascript, is a poor designed language, the scope of the variables is broken. Instead, PHP is well defined in this aspect.
- Klathmon 9y agoThe scope of variables isn't "broken", just different. Functional scope is a perfectly valid way to scope variables. Luckily ES2015 introduced blocked scoped variables (const and let), so this is no longer an issue.
- pluma 9y agoThis seems like an obvious troll comment. But I'd like to point out that "the scope of the variables is broken" doesn't make any sense: prior to ES6 JavaScript only had function scope -- which is not broken but also not what most people are used to. ES6 added let/const which are block scoped (and thus more familiar). Neither of the two is broken, nor did the addition break anything. The only oddity I can think of that would provoke such criticism would be a misunderstanding of non-strict-mode JS's behaviour with regard to implicit globals, e.g. what happens outside strict-mode when variables are used without being declared or what the "with" statement does (which is heavily discouraged). But that's like saying PHP is stupid because its array literals look weird.
- thehardsphere 9y ago> obvious troll comment Honestly, how can you tell? I feel like that's something someone could say if they are under the misunderstanding you (very aptly) describe.
- mmmpop 9y agoAny sufficiently advanced troll is indistinguishable from a real looney. https://en.wikipedia.org/wiki/Poe%27s_law https://en.wikipedia.org/wiki/Poe%27s_law
- pluma 9y agoClue 1: it praises PHP. Even PHP apologists usually restrict themselves to simply defending PHP rather than praising it. Clue 2: it calls JS "dangerous" and "poor designed" (sic). This is vague but provocative enough to invite emotional responses rather than factual discussion. Clue 3: it explicitly calls out "the scope of variables" as "broken". Again this is vague enough to be ambiguous but strongly worded enough to seem insulting. This is especially confusing if contrasted with PHP, which isn't exactly known for being intuitive and simple in that regard: http://php.net/manual/en/language.variables.variable.php http://php.net/manual/en/language.variables.variable.php But you're right, which is why I said it seems like an obvious troll comment rather than insisting that it can only be that. It might just be a poorly worded expression of frustration stemming from an incomplete understanding. Hence my attempt at a factual response.
- thehardsphere 9y agoI don't really think anyome ought to be starting flame wars over whether PHP or JS is a poorly designed language. It's like watching Hitler fight Stalin.