this post was submitted on 04 Jun 2025
1003 points (98.5% liked)

Programmer Humor

23795 readers
2687 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

founded 2 years ago
MODERATORS
 
(page 2) 50 comments
sorted by: hot top controversial new old
[–] onion_trial@europe.pub 6 points 1 day ago

Type of "not a number" is number

[–] whaleross@lemmy.world 43 points 2 days ago (3 children)

People that try to do mathematical operations with strings blaming the programming language that had a stated design goal to do its best and try to keep running scripts that make no sense because they realized it would be used by people that have no idea what they are doing. Clearly they were right.

[–] grue@lemmy.world 37 points 2 days ago (1 children)

the programming language that had a stated design goal to do its best and try to keep running scripts that make no sense...

...itself makes no sense. It is wrong and bad that Javascript was ever designed that way in the first place.

[–] whaleross@lemmy.world 22 points 2 days ago (2 children)

It was never intended to run full applications but only the small business scripts and hobbyist homepage stuff that were the thing in the 90s, across inconsistent browsers that were a jungle of hit and miss behaviour where it was preferred that menus keep working even if the mouse effect was not. Anything of scale was expected to be done in Java. Dynamic web pages did not exist and as anything not static was generated server side into a static html file to be rendered on the client.

Anyway, back then it wasn't considered the job of the programming language to hold the hand of the aspiring developer as it is common today. It's not a bad thing that IDE and even compilers and preprocessors try to help you write better code today, but then it simply didn't exist.

JavaScript is from a different time and because it has the hard requirement or backwards compatibility there is no changing it and has not been for thirty years except to add stuff to it.

I think it's just silly to ask the past to keep up with the present. Bad code is not the fault of the language regardless, even though junior devs and even seasoned ones like to think so to protect their ego. I think it is better to accept it, learn from it and roll with it because every single platform and language has their weird quirks anyway.

Signed, old dude that learned programming in 8 bit BASIC and 6502 machine code without an assembler, where code bad enough would freeze your machine that required a cold boot and starting over from your last save that you didn't do.

[–] BorgDrone@lemmy.one 13 points 2 days ago

Anyway, back then it wasn't considered the job of the programming language to hold the hand of the aspiring developer as it is common today.

But that’s exactly what it’s doing by trying to figure out what the developer meant. ‘“11” + 1’, should cause the compiler to tell the developer to to fuck themselves.

Executing after undefined behavior is arguably worse than terminating with an exception. A terminated script can't leak data or wreak havoc in other ways.

[–] 0x0@lemmy.zip 11 points 2 days ago (5 children)

it would be used by people that have no idea what they are doing. Clearly

And so let's enable these people?
Let's add AI to the mix while we're at it.

load more comments (5 replies)
load more comments (1 replies)
[–] proctor1432@lemmy.world 12 points 1 day ago

Heck, I need to learn some new languages apparently. Here I was expecting an angry "CS0029 cannot implicitly convert type 'string' to 'int'!

[–] MinusPi@pawb.social 23 points 2 days ago (22 children)

If you mix types like that, it's your own fault

[–] Shanmugha@lemmy.world 9 points 2 days ago (2 children)

Lol. In a dynamically typed language? I will do this always, that's why I am using it

load more comments (2 replies)
load more comments (21 replies)
[–] LovableSidekick@lemmy.world 1 points 1 day ago

It's my favorite language too, but I also find this hilarious.

[–] kubica@fedia.io 24 points 2 days ago (2 children)

Lets fix it. I think that since we are removing the ones, then "11" - 1 should be equal to "".

[–] r00ty@kbin.life 15 points 2 days ago (5 children)

Should it, or should it be "1"? (just removing one, one)

load more comments (5 replies)
load more comments (1 replies)
[–] bss03@infosec.pub 11 points 2 days ago* (last edited 2 days ago) (6 children)

This is my favorite language: GHC Haskell

GHC Haskell:

GHCi> length (2, "foo")
1
load more comments (6 replies)
[–] bradbeattie@lemmy.ca 19 points 2 days ago
[–] python@lemmy.world 20 points 2 days ago (1 children)
load more comments (1 replies)
[–] wreleven@lemmy.ca 13 points 2 days ago

Feels like it could be one of those facebook posts to test "smart" people. Only the top 1% of people can answer this simple math question: "11" + 2 * 2 - 3

load more comments
view more: ‹ prev next ›