Hacker News new | ask | show | jobs
by i_s 1647 days ago
I want to like powershell because of the richer return types, but it has so many strange deviations from normal shell languages that it is hard to get productive in it.

I remember testing out some new languages and toolchains and following the guides, but I would often get many of them that would not work because I was using powershell. Powershell has different syntax for escaping (backtick), starting arrays (parens), etc., that makes many commands completely incompatible (even very short ones).

2 comments

It is a complete re-imagining of what a shell scripting language is. Hardly surprising that it isn't backwards compatible or requires that you have to learn it.

People feel inconvenienced, which I get, but I feel like people don't give it enough credit for just how well-thought-out the design actually is.

Once you grasp it (which is admittedly easier if you know a Java-like language) your productivity skyrockets as commands are largely guessable and results are largely self-documenting. They have man-pages/get-help, but when an object is self-describing you don't need them as often.

The thing that disappoints me is that nobody from the *NIX world has tried to bring the same ideas there. They're good ideas.

> It is a complete re-imagining of what a shell scripting language is. Hardly surprising that it isn't backwards compatible

By why does having richer return types necessarily mean you need to deviate from most other languages for the escape character (backtick in Powershell, but usually backslash)? That doesn't seem related, and it greatly impacts the initial impressions people get.

> The thing that disappoints me is that nobody from the *NIX world has tried to bring the same ideas there. They're good ideas.

I agree, and I hope someone does. But if they do, I hope they just focus on the ideas, and leave out the small and unimportant incompatibilities powershell decided to add.

PowerShell was developed on Windows which uses '\' as the path separator by default. Using it as an escape character would be kind of confusing.
NuShell and Elvish are trying to bring in some of the same ideas.
Honestly I don't see that going anywhere. It was said somewhere upthread that the real value of PS was in the Microsoft management modules, and I'd add the .NET library to that. If you're developing from scratch anything a script might want to use, your battle is going to be pretty uphill.
Unfortunately I have to agree. Current efforts are constrained by the desire to integrate with existing tooling and the text-parser-based approach of the unix interfaces in general (in particular sysfs and procfs on Linux).

I honestly think someone should do this "from scratch", as you say. I believe the effort would be worth it, but I doubt that the unix community would be amenable to the idea as it goes against their deeply held cultural traditions.

You may as well complain that the C guides didn't work in Java. A new language being compatible with an old one just weighs it down with forty years of cruft.
> You may as well complain that the C guides didn't work in Java.

Java borrowed a lot of syntax from C, and it has been very successful. If Java had instead taken the powershell approach of needlessly deviating with the syntax, it probably would not have become as popular as it did. So that example supports the opposite of what you thought it does.

Wrong example, clearly. But just replace it with Python then.
You think I'm saying "don't be different for any reason." What I'm actually saying is "don't be different without a good reason". Python for example has been criticized for the breaking changes in version 3, which caused a lot of problems for the community, arguably without a good reason.