27

Javascript walks into a bar

Comments
  • 3
    I'm not a JS fan, but this is totally logical.
    You: String + Int
    JS: That not possible! the only way is to concatenate them.

    You: String - Int
    JS: Thats not possible! the only way is to cast the string to a numerical type.

    What is wrong with that?

    You know, the problem is with using '+' for concatenation. the only language with fixed this problem is PHP, which uses '.' instead of '+' for concatination.
  • 1
    @yakooza eh .. I understand what's going on, but types should still not be converted automatically. Both of those statements should give you and error unless you cast them to the right type. Python mostly does this right and it's a dynamically typed language too.
  • 1
    @djsumdog Use PHP to feel the joy of Auto-casting, that common sing ('+') for both concatenating and adding makes all the problems.
  • 0
    @djsumdog Come back when you deal with user input in a language like Java, and have to write 10+ lines just to get stdin, then try ... catch every single line to catch casting errors, then handle NaN, then write a shitload of formatting strings you can't even remember, and then get some weird error because variable type doesn't match formatting... And to top it off everything blows up if any of that isn't right or if user input doesn't match exactly.

    Yeah that's what I want from a website, a shitload of casting and checking code everywhere to bloat my browser, and occasional white screen because I put a comma instead of a decimal dot in some input.
  • 1
    @hitko Calm down dude!
  • 1
    @yakooza Oh I'm sorry, I thought this was DevRant not r/ProgrammerHumor

    Also anyone knowing more than one language / domain knows when you're dealing with lots of random user input it's a nightmare to use rigid language where everything has to be manually converted with a load of checks or it will blow up, and I'm getting tired how DevRant is getting flooded with the same dumb, ignorant, and overused jokes, which get upvoted by the same ignorant idiots who only find them funny due to their lack of experience with anything else. And in the meantime those with actual experience and rants are leaving one by one...
  • 0
    @hitko I'm all for your opinion about input and overload. But I think we have to accept that Hello-world developers are more active Due to Dunning–Kruger effect, (I'm not judging @djsumdog). If you want my advice, Take it easy, enjoy knowing more than others! help them, and have fun.
  • 0
    @yakooza Devs create groups, sites, forums, chat rooms for themselves, because the existing ones don't suit them. They're happy there. Then some noobs looking for validation join in and since they can't contribute to the intended content, they contribute bullshit until the whole thing slowly dies out and the initial community moves somewhere else.
  • 0
    @hitko Unfortunately, that is true.
  • 0
    @hitko man that's why you use a framework like spring. To handle 90% of the hassle for you
Add Comment