this post was submitted on 17 Jul 2023
520 points (97.6% liked)
Programmer Humor
19623 readers
75 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Type error unless there's an implementation of
+
that specifies adding together and integer and a string.๐ฏ% accurate. funny how the typescript developer thinks this is some kind of "gotcha!"... like maybe just try a language besides typescript and find out for yourself ๐
"brought" ๐
my complaint is that typescript is stupid, yes. so why wouldn't i compare to what other languages do that is less stupid?
on the plus side, at least now i know that the ad-hominem minded devs came here too, and brought their righteousness with them.
OCaml ๐
Exactly. Most languages I know of that allow this at all will coerce the "1" to an integer and give x = 2. They get away with this because they define the "+" operator as taking numbers only as arguments, so if you hand them
x = x + "cheese"
they'll error out.