this post was submitted on 26 Aug 2023
1500 points (97.5% liked)
Programmer Humor
19551 readers
1088 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
Unfortunately, bash syntax isnt amazing either
But Powershell is worse
Yeah. I've said this before and got grilled for it but I wish there was a shell scripting language that doesn't have arcane syntax.
Fish? I like fish.
Can anyone name any living language, scripting or otherwise, without arcane syntax?
Perl, no wait you said without arcane syntax....
Bash came out decades ago and powershell is brand new. It doesn't really have an excuse to suck.
I hope I didn't come across as defending ps. PS sucks and whoever decided to have functions use capital case with dashes in between needs to have their brain scanned
I do a lot of work in PS and I don't find it that bad. But you forgot what's even dumber about their function naming conventions.
Function names are supposed to be a single word verb, then the dash, then the rest. But not any verb, you're supposed to use one from PS's list of acceptable ones which has some really weird omissions. And they break their own single word verb convention with "acceptable verbs" ConvertTo and ConvertFrom (ConvertTo-SecureString, ConvertFrom-Json), which are the only exception to one word verbs before the dash.
Function names are definitely one of my biggest peeves with it.
Additionally, their basic comparison operators are dumb as hell. How is "-le" better or clearer in meaning that "<="? -ne instead of !=, but == isn't just -e, it's -eq. And you can't slap an n in front of other comparators for not, -nle isn't a thing. You gotta wrap the whole comparison in parentheses and slap an ! on the front or slap -not in front. But don't try to do !-le, because that's also not a thing. It's not terrible but I refuse to believe that -eq is more readable than ==
Functionally speaking, PS is a really good shell language. Its minor things about it that I dont enjoy. As you said, it feels like the language design has some poor decisions.