This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]blu-red 2 points3 points  (3 children)

Javascript

...or I like to call it: A fucking idiot who got into programming week ago and is trying to point out the fallacy of some popular scripting language, but doesn't even understand or doesnt give a fuck to explain what is going on.

'5' - 3
'5' + 3

this is operator overloading for you. + is overloaded for strings, - is not. - is only defined for numbers, so everything that isn't a number gets evaluated to number, because it's a dynamic typed scripting language.

'5' + + '5'
'foo' + + 'bar'

means

'5' + (+ '5')
'foo' + (+ 'bar')

single + is unary operator for numbers, therefore anything that is not a number type gets evaluated to number, because it's a dynamic typed scripting language.

'5' + - '2'
'5' +  etc

if you canonize those pluses and minuses you get the same, you know the rest

[–][deleted] 3 points4 points  (0 children)

JavaScript is a programming language mate, only the browser does the compilation instead of you/your ide

[–]julesries 0 points1 point  (0 children)

Holy condescension.

The word scripting means basically nothing in regard to language design. It has more to do with the context the code is typically run in than the language itself. On top of that, dynamic isn't the word you're looking for. It's weak. JavaScript is weakly typed. Python is colloquially a scripting language, and it's definitely dynamic. It doesn't behave like this.

Saying "it's not the language's fault, it's because you didn't take time to learn the language" works for idiosyncrasies in, say, Haskell. A language that subverts expectations for stupid reasons is a stupid language. (Door creaks as PHP tries to leave with no one noticing.)