this post was submitted on 02 Oct 2024
631 points (96.5% liked)
Programmer Humor
20039 readers
1617 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 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Alright, spicy opinion time: I think, the
!
operator is dumb.It's yet another symbol with a meaning, which people have to learn.
And it's easy to overlook, especially in languages with parentheses in their if-conditions:
I think that just a
.not()
method on Booleans is cooler:You can do this in Rust, which is where I have that idea from: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=dedb71bd84243c78ee0afad0f30b80c3
Would you say that it reads better as "not x" or "x not" (if we remove all special characters)?
I mean, that is more obvious and more readable.
But what I really don't like about it, is that it's less clear to what it applies. For example:
Is that
not (a and b)
or(not a) and b
?Obviously, you can define precedence rules, like there also is for
!
, but that's again just additional things to learn.I'm definitely not generally opposed to special characters. I do also hate significant whitespace, because I find that less readable than braces.