this post was submitted on 02 Oct 2024
606 points (96.3% liked)

Programmer Humor

19480 readers
175 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 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 17 points 1 month ago (3 children)

We use ! because keyboards no longer have buttons for ¬, which is the other logical not.

[–] [email protected] 5 points 1 month ago

We could have used the tilde, which has been used in formal logic & maths for negation in very many contexts for a long time.

It's used instead in C and many C-like languages for the far less useful bitwise negation. Of course, we could have had it work in the same way as bitwise vs logical and & or, by dialling up the symbol. Which would have massively improved its visibility compared to the bang.

But for some reason, no. They chose the bang instead.

[–] [email protected] 4 points 1 month ago (1 children)

My (ISO) keyboards do, under the Esc key. I guess you're in North America (or Australia) and have an ANSI layout.

[–] [email protected] 3 points 1 month ago

Ah, yep. I have very little knowledge of keyboards in other parts of the world, unfortunately.

[–] [email protected] 0 points 1 month ago

Oh, I know where it came from. That's also why we have all kinds of maths operators in the syntax of virtually any programming language. Because back when we didn't yet know where this programming thing was going, we just threw in the conventions of maths and theoretical logic.

What I'm saying is that we have our own conventions now, i.e. objects and methods, so I think, it's worth reconsidering whether we still want to have these old conventions that are special cases in the syntax.