sag@lemm.ee to Programmer Humor@programming.dev · 3 months agoNotfiles.catbox.moeimagemessage-square18fedilinkarrow-up1429arrow-down121
arrow-up1408arrow-down1imageNotfiles.catbox.moesag@lemm.ee to Programmer Humor@programming.dev · 3 months agomessage-square18fedilink
minus-squareEphera@lemmy.mllinkfedilinkarrow-up6arrow-down12·3 months agoAlright, 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: if (!list.isEmpty()) { ... } I think that just a .not() method on Booleans is cooler: if (list.isEmpty().not()) { ... } 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
minus-squareDarkenLM@kbin.earthlinkfedilinkarrow-up23·3 months agoMathematics themselves are essentially tons of symbols that people have to learn, tbf. I personally never had any trouble looking at the negation operator, and find the .not() postfix cumbersome.
minus-squareMBM@lemmings.worldlinkfedilinkarrow-up3·3 months agoTo be fair, mathematics also uses single-character variable names
minus-squaredosuser123456@lemmy.sdf.orglinkfedilinkarrow-up1·1 month agoactually names his variables “x, y, z, etc etc” when coding
minus-squarepalordrolap@fedia.iolinkfedilinkarrow-up10·3 months agoThe ol’ postfix ‘not’. Wayne’s World is a thing of the past! … NOT
minus-squareMaggiWuerze@feddit.orglinkfedilinkarrow-up1·3 months agoKotlin has not, and, and or utility functions as well
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:
if (!list.isEmpty()) { ... }
I think that just a
.not()
method on Booleans is cooler:if (list.isEmpty().not()) { ... }
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
Mathematics themselves are essentially tons of symbols that people have to learn, tbf.
I personally never had any trouble looking at the negation operator, and find the
.not()
postfix cumbersome.To be fair, mathematics also uses single-character variable names
LaughsCries in engineeringactually names his variables “x, y, z, etc etc” when coding
The ol’ postfix ‘not’. Wayne’s World is a thing of the past! … NOT
No way dude!
Kotlin has not, and, and or utility functions as well