Comment by hi-v-rocknroll

Comment by hi-v-rocknroll 2 days ago

45 replies

I like the ideas of Dune and Nu, which I think were trailblazed by powershell to a degree. The problems of pure *NIX pipe philosophy with text as the lingua franca were persistent parsing problems and escaping. However, the problems of going to far in the way powershell went was it was too radical having to reimagine/replace/relearn almost everything, and generally more difficult to accomplish simple text manipulation. Nu at least maintains most of the *NIX shell UX. Maybe at some point in the future, we will reach parity to where there will fusion of the main DSLs, shells, and programming languages into a runtime interaction system that is somewhere between psql, Erlang shell, nu, and Squeak where there is programming language-OS parity obliterating the distinctions between programming languages, command shells, and DBMS shells. One can dream of a future where perhaps it will be possible to write a function, library, or program in any language one chooses and call it from any other shell or language without swig or ceremony.

Brian_K_White 2 days ago

The problem of powershell is not merely thet it's new and different, and not merely that you have to learn a new and different way to get a given task done.

Powershell makes some things possible or easier that weren't possible or easy, but only at the expense of making other things either impossible or at least vastly less practical, and all in all it's a bad trade off and a wrong set of priorities for the job it claims to fill, or at least for the job bash currently fills. It's not that bash is a gold standard, just that it's not fundamentally wrong.

  • xelamonster 2 days ago

    It's also just absurdly verbose for a language intended mainly for manual input. I get annoyed having to type out `sudo systemctl` multiple times in a row, in Powershell every single command is at minimum that long. Which makes it way more difficult to memorize the commands too.

    • WorldMaker 2 days ago

      There are ton of aliases. It's "impolite" [0] to use aliases in scripts and documentation so looking at PowerShell examples is way more verbose than actually using it day to day in a REPL. Sure I could write `Set-Location` a million times a day, but I just use `cd` in the old ways. Same with `Get-ChildItem`, I tend to just use `ls` myself because of ancient habits. (I find it interesting how many have been moving to `gci` instead as the more PowerShell-native `ls` alias. I've not been convinced to do that myself, but I think it has to do with `gci` is way more powerful than most shells' `ls` and is used to navigate everything from folder structures to object structures including that its not a bad `jq` if you convert JSON files to PowerShell objects.)

      [0] It's from a version of the Python ethos that code is read way more often than it is written, so when you are polishing PowerShell code to share with others you expand all the aliases so that it is easier to read.

      • xelamonster 2 days ago

        Using a different set of commands in the terminal versus scripts and documentation makes no sense to me, why would I want to learn two different ways do the same thing? Python does not expect me to use `open` in the REPL but prefer `get_file_handle` in published scripts, their ethos works because the entire language has an emphasis on relatively concise readability.

        Every single command starting with `Get-` or `Set-` adds so much noise and makes things really hard to visually distinguish too. I don't want overly verbose commands in scripts for the same reason I don't want them in the terminal, it's still a pain to write and even if you have some autocomplete it makes editing harder. I don't think `ls` is any less clear or harder to learn than `Get-ChildItem` really, that name doesn't even actually give me any clue what the command does.

        • 7bit a day ago

          It's not hard to learn. And if you don't want to, then don't. That's really not something someone cares about, unless you're working in a team.

      • frenchyatwork 2 days ago

        What about the part of the Python ethos where "There should be one-- and preferably only one --obvious way to do it"

    • Vegenoid 2 days ago

      IMO, getting comfortable with and tuning autocomplete makes this a non-issue, and the benefit of the verbose commands is that they are very discoverable.

      • rustyminnow 2 days ago

        Any tips or links for tuning? zsh has a powerful engine and lots of great work out there, but when I've tried cooking my own it's all just too dense to get "comfortable" for long.

    • emmelaich 2 days ago

      Do you know that there are short versions? e.g. gc for Get-Content

    • abhinavk a day ago

      > sudo systemctl

      Make an alias like sctl. Takes 5 seconds.

      Or an abbr if you are using fish. They are more like text-expanders than aliases.

    • 7bit a day ago

      Really? I only have to remember Item instead of touch, mkdir, RM, rmdir, cp, mv. All commands that have just different verbs before the Noun in Powershell. And that's for every single cmdlet out there.

      It sounds to me that you're unfairly putting your existing knowledge about Linux shells into your criticism of PowerShell. If you want to be fair that criticism should come from the POV of someone who does not now both and now wants to memorise it. And whether or not commands are short or long does not matter. People memorise lyrics, or names of hundreds of people. Length is not a factor, objectively.

      And alias do exist.

  • TristanBall a day ago

    Curious as to what's "vastly less practical" in powershell?

Aurelius108 a day ago

I was scripting on a windows machine which didn’t have WSL setup and decided to learn PowerShell. After a week or so of scripting with PowerShell and seeing how intuitive and robust the syntax is, something changed in my brain and I decided I never again wanted to deal with bash and its endless quirks and brittleness. It’s unnatural to have to wrap every variable access with “${}”, that unnatural key sequence always caused a break in my flow. Anyway I reach for Python sooner and really hunger for a clean, robust nix shell. I hope powershell has instilled this in many people and it drives adoption of something better

  • dgan a day ago

    I have tried to do the same, but i have opposite experience. I just can't grok the syntax, it always seems like a magician pulling out another "Haha! I bet you haven't seen this one coming !"

    Like, i can't even construct the abstract model of how it's supposed to work

    • brazzledazzle 20 hours ago

      Would you be able to provide an example? I'm not doubting your experience, just incredibly curious since I had the opposite experience.

      • dgan 17 hours ago

        Sure thing :

        $env::Path (the semicolon? so Path is not quoted here? But when I assign a value it's quoted?)

        Dir -r | %($_.Name.ToLower) ( what is this? statement dreamed by utterly deranged)

        They took us for absolute fools

    • plaguuuuuu 21 hours ago

      I'm even a windows .NET developer and I also find Powershell extremely weird. I'm not sure what it is.

wodenokoto 2 days ago

> too radical having to reimagine/replace/relearn almost everything

I switched to zsh because at the time I thought it had better autocomplete, but honestly I use it as I would bash. And I don't think it was worth it to change a little bit.

To change shell I think the change _should_ be radical.

  • idunnoman1222 a day ago

    But it is bash…

    • MrDrMcCoy 17 hours ago

      Not quite. It has some incompatible default settings, and is missing a small percentage of obscure bash features that I sometimes like to rely on. I'm sure I could do it all with zsh just fine, but it would be more work for me mentally.

kitd 2 days ago

A day or so there was this: https://news.ycombinator.com/item?id=41558081

Imagine your shell's model not being a command line console but a spreadsheet!

  • ghayes a day ago

    I wonder if there's a good middle ground where unix commands could opt into a structured output, and until they exist, you could shim via `ls -la | shim "ls -la" |> ".modified_time"`. Then one day it could be `ls -la |> ".modified_time"` when structured data is supported natively by the program or command. I feel every project ends up dying since it needs to support every command all at once to be useful.

  • actionfromafar 2 days ago

    Shades of Q, APL and other array languages, but visual by default. Maybe an APL spreadsheet-shell would fit the bill? :-D

082349872349872 21 hours ago

> One can dream of a future where perhaps it will be possible to write a function, library, or program in any language one chooses and call it from any other shell or language without swig or ceremony.

Was that not VMS?

packetlost 2 days ago

> One can dream of a future where perhaps it will be possible to write a function, library, or program in any language one chooses and call it from any other shell or language without swig or ceremony

I mean, there's a reason text was selected, it's the lowest common denominator. What you're asking for is universal FFI, which we already have that for the most part: C. The problem ultimately turns into runtime and resource management issues when crossing language boundaries, that is, unless you use OS primatives (pipes, sockets, shared memory, processes, etc.) and use message passing/pipelines exclusively. Then we're back to plaintext.

There's a ton of non-printable characters in ASCII that are useful as delimiters for non-keyboard interactive programs that are largely vestigial. One could at least consider reusing them for delimiters and special control sequences for message passing, but without some sort of standardization it's limited in practical use.

  • Brian_K_White 2 days ago

    The problem with those ascii values is editors don't display them and there are no keyboard keys to type them.

    The reason csv exists is because you can actually see and type all parts of it, on anything, any platform, any hardware, any software, any age, even a mechanical typewriter, even a pencil. That is not merely nice, it's essntially priceless, infinitely, incalculably valuable. The utility outweighs the problems as big as they absolutely are. Actually the same is true for json, yaml, xml...

    • packetlost 2 days ago

      > The problem with those ascii values is editors don't display them and there are no keyboard keys to type them.

      Did you read my post? Like, every word of it? Being able to type a control sequence is not particularly useful for ephemeral data in a message-passing between programs context. It's absolutely important for persistent, editable data. It seems like more of a feature to me to use these special characters for special contexts and not have escaping typeable characters be load-bearing.

      Further, my editor seems to print control characters just fine, though entering them would be a bit of a pain and the behavior is likely configurable.

  • superb_dev a day ago

    Nitpick but I wouldn’t call C a universal FFI, it’s merely the de facto FFI. C can’t meaningfully represent any complex language semantics (not that it should or even could)

    • packetlost 19 hours ago

      It's a near universal de facto FFI if we're being pedantic. My whole point was the reason that's the case is it has essentially no runtime expectations at all, which is a requirement for a truly universal FFI.

  • WorldMaker 2 days ago

    Instead of inventing some new delimited formats, we also already have nearly ubiquitous interchange formats like JSON. If you wanted to reduce the in memory footprint versus plaintext encoding the JSON there are good options like BSON and CBOR.

    • packetlost a day ago

      JSON isn't streamable. Neither is CBOR for that matter, though it's not quite as bad.

      • superb_dev a day ago

        Individual JSON records are streamable

        • packetlost 19 hours ago

          JSON itself, no, that's not the case. If you accept an extension like JSON Lines, it can be. Many decoders will barf if you have multiple top level objects in the same file. If you want portable, non-ephemeral data JSON Lines is a poor choice.

MrDrMcCoy 17 hours ago

> One can dream of a future where perhaps it will be possible to write a function, library, or program in any language one chooses and call it from any other shell or language without swig or ceremony.

That's a neat idea, and sounds like something that could be built on graalvm.

hnlmorg 2 days ago

There are shells out there that sit between PowerShell / Nu and the old guards like Bash / Zsh.

Ones that support data structures out-of-the-box (like any et al) but also work perfectly fine with existing UNIX commands (like Bash).

solidsnack9000 a day ago

Maybe tabular data is a credible intermediate step. Many shell tools already export data in a tabular format.

actionfromafar 2 days ago

To me the silly hang-up for PowerShell is none of that, but the strange syntax. I'd taken (even!) JavaScript-ish syntax over that.