Hacker News new | ask | show | jobs
by tdeck 3522 days ago
You'd think this would be true, but I've written a few non-trivial things in PowerShell and I always found it frustrating. The problem with the object pipeline is discoverability. When I'm writing a Bash script and I don't know what a command will return, I can just run it and see. Meanwhile, in PowerShell, I have to rely on repeated attempts at pretty-printing and/or external documentation, and I've found both to be lacking in several cases.

While I'm at it, another thing I didn't understand was why they chose to copy Bash's behavior of having anything printed or returned un-suppressed inside a function be part of its return value. That makes it harder to refactor and clean up your code.

2 comments

> You'd think this would be true, but I've written a few non-trivial things in PowerShell and I always found it frustrating.

I've written some trivial things in powershell and found the complexity grows at functionality squared. Wouldn't go near it for anything complex.

I rely a lot on the built-in ConvertTo-Json command as a good way to get a sense of a full PS object. I've seen very neat GUI "object browser" tools you can pipe to from PS in screencasts, but don't do enough PS work to ever recall their names.
I just pipe to 'select *' now but converto-json sounds excellent.