Javascript

Nov 14, 2005 02:16

I want to meet the asshole who decided it'd be a cute idea to make the string concatenation operator the same as the mathematical addition operator.

Javascript. The only programming language where 2 + 2 = 22.

rant

Leave a comment

Comments 21

surazal_roman November 14 2005, 08:19:09 UTC
... Ah.. Uhh. Programming makes my head explode. My friend shoved Python, AppleScript, and C down my throat last year when we were teacher aides in a computer class. I don't like if statements.

Reply


with_my_pistola November 14 2005, 09:37:18 UTC
yeah!... grr!... asshole!...??

Java, such a distant memory... damn those semicolons!

Reply


jerseygrits November 14 2005, 13:43:14 UTC
Who knows Russian better, you or Philip?

Reply

pavel_lishin November 14 2005, 17:36:10 UTC
Uh, Philip, I pretty much guarantee.

Reply

philipmw November 15 2005, 06:40:19 UTC
Although I pretty much guarantee that Pavel knows Javascript better.

And in the end, isn't that what counts?

Reply

pavel_lishin November 15 2005, 16:20:02 UTC
Hah!

Reply


drags November 14 2005, 14:27:41 UTC
but but but.. Operator overloading is amazing. Next time don't add 2 string literals ("2" + "2") and you should be fine :o

int + int = int
literal + literal = string...

this is why I stick to php/perl though, I hate writing classes and overloading shit and all that jazz.

Reply

pavel_lishin November 14 2005, 17:37:51 UTC
Sure, it's amazing - but having to multiply form values by one and then having to add them just to make them ints confuses and angers me. Would it have killed them to implement . as a string concatenator, like PHP does?

Bah, whatever - Javascript is a pissant little language that's suddenly important because people realized the power of Ajax.

Reply


pbaseball24 November 14 2005, 16:49:08 UTC
I have no clue what you're referencing.

You elitist asshole.

Reply

pavel_lishin November 14 2005, 17:38:39 UTC
Alright, string concatenation is just putting two strings together - like "dog" + "cat" = "dogcat". In PHP this is done with a period:

"dog" . "cat" == "dogcat"
In Javascript, they use a plus.

"dog" + "cat" == "dogcat"

Annoying!

Reply

pbaseball24 November 14 2005, 17:43:06 UTC
Basically...

You're bitching that you have to use a plus symbol versus a period? Or you're bitching that the plus symbol doesn't actually add a goddamned thing, it simply connects the terms at the hip (more or less)?

I'm guessing both, because you're a jew like that.

Reply

branderson November 14 2005, 19:59:21 UTC
The problem is that the + operator has been ambigously defined to do different things in different circumstances. If it is given two numbers, it will add them normally, however, if it is given two strings, it will concantenate them like Pavel demonstrated in the previous post. There really is no reason for such sloppy notation, and I'm sure they could have chosen another intuitive way of expressing the same thing.

I'm guessing from his previous posts that at some point Pavel tried to add the input to two forms, which are strings, and got another string, rather than the number he desired, which probably lead to hours of debugging.

Reply


Leave a comment

Up