311 pointsby SteveHawk2710 days ago19 comments
  • nindalf10 days ago
    Fish 4.0: The Fish Of Theseus (https://fishshell.com/blog/rustport/) is the full story of their rewrite from C++ to Rust.

    Discussed on HN here - https://news.ycombinator.com/item?id=42535217 (906 points, 198 comments).

    Highlights of the rewrite

    - 1155 files changed, 110247 insertions(+), 88941 deletions(-) (excluding translations)

    - 2604 commits by over 200 authors

    - 498 issues

    - Almost 2 years of work

    - 57K Lines of C++ to 75K Lines of Rust 5 (plus 400 lines of C 6)

    - C++–

    • ivanjermakov10 days ago
      I'm surprised Rust took more lines. Perhaps formatter makes shorter lines due to method chaining? Or improved test suite?
      • duckerude10 days ago
        According to the blog post (https://fishshell.com/blog/rustport/#fn:formatting):

        > A lot of the increase in line count can be explained by rustfmt’s formatting, as it likes to spread code out over multiple lines [...] The rest is additional features. Also note that our Rust code is in some places a straight translation of the C++, and fully idiomatic Rust might be shorter.

      • nicce10 days ago
        Rust code defenitely takes more space with default formatter settings if you use functional paradigms. Every chained function call in many cases is one extra line. Default line width is not much anyway. Also if you handle all return types, lines will add up.

        Since there are quite many contributors, it can be difficult to introduce some advanced macro requirements for the project, which could reduce the code.

      • dartos10 days ago
        Rust, IMO is a noisy language. So not surprising it took more lines.

        Having to handle every case of every branch also probably balloons line count.

        Efficient LOC is not a goal of rust at all anyway.

        • Cthulhu_10 days ago
          Efficient LOC shouldn't be a goal or metric anyway, readability trumps conciseness... except when conciseness improves readability.
          • rootnod310 days ago
            Agreed. I would rather be forced to explicitly cover all match cases than accidentally run into problems that are hard to debug.
            • pmarreck10 days ago
              Exactly. I wish all languages implemented things like this, a bit more strictness (such as requiring all possible match cases to be handled across a set of inputs) goes a long way
              • rootnod310 days ago
                Not all though. I am currently writing my own Lisp dialect, and as much as I wish and hope I will be able to force case/switch to be exhaustive, I don't see a direct way for that in a dynamically typed version.

                I do plan to add something similar to Clojure's spec though, so the compiler can at least be advised about things and warning if stuff is missing.

                But I do agree, any statically typed language should have that check and not just warn about it. It should be a hard error, no questions asked. And I love that Rust didn't relegate it to a warning that could be turned be into an error.

          • sceptic12310 days ago
            If conciseness improves readability then doesn't readability still win?
        • darthrupert10 days ago
          So is C++ though. But the "wasteful" (in terms of vertical space) formatting does indeed explain the difference.
      • yencabulator8 days ago
        Beyond what others have said about superficial things like laying out code differently, remember that Rust encodes memory-safety-related information in types, function signatures etc that might not exist at all in a C/C++ "we hope you do it right, or it's UB" codebase.

        Also, here's a code size tracker that counts tokens not lines, which is a better measure: https://github.com/rrethy/tcount

      • bonzini10 days ago
        First experiences with QEMU suggest ~10% more lines of code.
      • kccqzy10 days ago
        Not surprising to me. While learning Rust, I rewrote in Rust several existing programs I had written in C++ and all of them were longer with default formatting.
  • abound10 days ago
    The most interesting thing about Fish 4.0.0 for most people will be that it is now written in Rust, which they talk about here [1]. Looking forward to testing it out and seeing if there are any noticeable differences.

    [1] https://github.com/fish-shell/fish-shell/pull/9512

    • markstos10 days ago
      I'll be curious if it's faster.
      • robin_reala10 days ago
        It’s broadly the same speed currently, but the goal was always to do a simple port to start with, then iterate from there.
      • bjoli10 days ago
        Anecdote time: I did a test like this with a small hobby project of mine (c++). I ported it to rust and saw roughly a 25% speed increase because of some refactorings I was meaning to do for a long time. I then ported the rust code back to c++ and saw another 15% gain in performance. Backporting the changes to rust again yielded no significant difference.

        I am no rust programmer though, and I don't think the rust code was very idiomatic.

        But then again I apparently write c++ like a common lisp programmer...

      • darthrupert10 days ago
        Faster than previous C++? Only if there were actual performance bugs that they fixed while doing the port.
        • rootnod310 days ago
          What makes you think so? The Rust compiler is able to instrument LLVM a lot better and provide it with a lot more info than C++ can. The borrow checker does a lot of the work there to for example keep things on the stack or do LSE or GSE and other optimizations. It isn't just about "oh, the rewrite allowed them to restructure things and optimize the algos". It is also that Rust due to its nature is able to be absolutely damn fucking sure that it can remove or optimize certain parts, whereas C++ can't in many cases.
          • steveklabnik10 days ago
            Additionally, some people shared that they feel more comfortable making more aggressive optimizations in their Rust code because the borrow checker has their back.

            Stylo was tried twice in C++ before the Rust attempt, and it never worked out, because the threading was too hard to get right. In theory you could have done it. But in theory, theory and practice are the same, but in practice, they’re different.

            • rootnod310 days ago
              Oh definitely. Refactoring in Rust is a lot safer. Sometimes a lot more cumbersome, but definitely safer. Sometimes a refactor introduces a lifetime to a structure and now a loooot of places need changing, but at least it's safer. In C++, it would be less safe, but I could compile it and test the part I am trying to change or test first. It's a pro and con on either side.

              But for the end product, I err on the safety side for sure.

            • vanderZwan10 days ago
              IIRC, you yourself commented a few years ago in a thread on HN that the Rust situation was still a lot like "because of certain guarantees Rust makes we should be able to perform tons of optimizations that C++ could never do, and we haven't even gotten around to implementing most of them yet", has that situation improved a lot since?

              ("a few" might be off by pre-pandemic amount of years, my memory is a bit fuzzy there)

              • steveklabnik10 days ago
                I vaguely remember that :)

                It's progressed in the sense of like, the Unsafe Code Guidelines and opsem teams are hammering down the exact semantics still, and have made a lot of progress. I'm not aware of any actual optimization work taking place off of it yet, which would make sense given that it's not all fully hammered out yet.

                I also might have been handwaving towards how restrict kept having to be turned off because it was broken, meaning very few C or C++ codebases seem to use it at all, whereas virtually every Rust reference has it on. It's been back on for a while now.

                • vanderZwan9 days ago
                  Yeah I forgot the exact context of the quote too, no worries :). EDIT: it probably had something to do with aliasing and alignment (because when aren't people sighing about C/C++ when it comes to that topic?)

                  Thank for the general update! I might not write any Rust code myself, but I do enjoy quite a few programs written in it, so I was hoping to hear there was more progress for the sake of the developers behind those programs. But I can also imagine that these kind of things take time to figure out properly, to avoid repeating mistakes of previous languages (and that's before we even get to the task of implementing anything).

                  Wish the people working on these issues all the best, and looking forward (from the sidelines) to what eventually comes out of it!

          • 10 days ago
            undefined
    • enriquto10 days ago
      [flagged]
      • lolinder10 days ago
        In what way does fish being built with cargo affect you as (not even) a user? Were you fish-curious in that you were interested in becoming a contributor? Or do you make a habit of judging projects that you might be interested in using based primarily on their build system?
      • akdor115410 days ago
        I dont like lisp but hackernews is still fine to browse?
      • dmd10 days ago
        Why would you care what it's written in at all, unless you plan to work on it yourself?
        • lytedev10 days ago
          The same reason you might care about the artist or producer of a song: its context generally implies certain characteristics you might associate and appreciate.

          For example, most Rust projects use clap which provides really nice command line help menus and also have relatively good performance in general.

        • enriquto10 days ago
          > Why would you care what it's written in at all

          Well, actually, it was the OP who said, literally, that "the most interesting thing about Fish (...) will be that it is now written in Rust"

        • t4356210 days ago
          In a sense why should anyone care about this article? It's a shell, why is rewriting it in Rust noteworthy?
          • rootnod310 days ago
            Only noteworthy if it was done using or now features a LLM :D
      • arbitrandomuser10 days ago
        What does it matter which tool-chain they use . I can understand if the difference is it made it notably slower or they dropped some features because they couldn't get it done in rust . But purely as an end user why would it matter if it's written in rust or cpp ?
      • benrutter10 days ago
        What do you dislike about it?
        • enriquto10 days ago
          quadratic dependency encouragement
        • johnnyjeans10 days ago
          the only vcs it supports is git
          • steveklabnik10 days ago
            The —-vcs flag to cargo new supports git, hg, pijul, and fossil.

            It’s true that dependencies from a repository only supports git right now.

            Part of the issue there is just like, the VCS integration wasn’t don’t in a principled way (it happens!) and so it’s not simple. See here for more: https://github.com/rust-lang/cargo/issues/12102

            • johnnyjeans10 days ago
              no darcs?

              and this is why i really loathe language package managers, because they're prone to this kind of thing. assuming one has no problems with the opinions made in a language itself, when it has a tightly bound package manager embedded into it's ecosystem (using rust without cargo is like pulling teeth) you have an entire extra hurdle of far more rigid and controversial opinions to deal with.

              package managers are maybe next to shells with "it's several orders of magnitude harder to make a good one than it is to write a compiler." with the dozens, possibly hundreds of package managers i've touched over the years, there's only been one that i'd call "good". the absolute worst ones have always been language package managers. at this point i've basically written off the concept, even system package managers.

              • steveklabnik10 days ago
                I’m not sure I’ve ever heard of a Rust programmer using Darcs. Anyone likely to would use Pijul.
                • johnnyjeans10 days ago
                  well that's the thing, you never know. certainly if i ever used rust to a serious degree, i'd not stop using darcs. however right now that'd necessitate bypassing the whole package management part of cargo, at least for my own libraries (and i suffer from a terminal case of NIH syndrome)

                  i don't think it's reasonable to assert that my own quirks and tastes are explicitly tended to. and that's why ideally you just give the programmer space to do whatever, hence why it's so hard. vcs is just one single point of contention. this isn't unique to rust by the way. cargo is arguably a bit better than the dune experience, it's a bit more flexible and feels simpler.

                  arguably system package managers are better here, since they're effectively opt-in by choosing what distribution of what operating system you use. language package managers don't have that luxury.

                  • steveklabnik10 days ago
                    What I mean is that in open source, things only get done by people motivated to do them. Nobody has ever even asked for darcs support: https://github.com/rust-lang/cargo/issues?q=is%3Aissue%20sta...

                    So the lack of darcs isn’t because the Cargo folks think it’s bad or something. Just that things don’t get added just because.

                    Re quirks, sure, that’s why rustc and cargo are different. You don’t have to use Cargo. Meta does not, the Linux kernel does not.

                    • johnnyjeans10 days ago
                      sure sure, and what i mean is that ideally the package manager can be made to use any arbitrary vcs system by the programmer. that's all. early on choices were made with cargo's development to where it's non-trivial to make something like that work, you touched on that briefly. it's a good example of why making a package manager is hard, there are so many aspects to them and it's really easy to engineer yourself into a corner to where any individual aspect of them might be flawed. typical software problem, expounded by the fact that package managers are deceptively complicated. doubly expounded by what i mention with language package managers not having the "opt-in" inherent quality of system package managers, not in the same way.

                      ideally it'd just have an interface you can write a module against. maybe they've added that? i sure hope they didn't have to hardcode the options of that new vcs switch ;)

                      > that’s why rustc and cargo are different

                      indeed. but rust analyzer really likes you to use cargo. i know it provides facilities for specifying a json in place of cargo.toml, which is great, but my limited experience with that saw me running into some weird issues (maybe they've been fixed, maybe it was just a skill issue.)

                      also i will say cargo does at least let you specify local paths as dependencies relatively painlessly, so it gets points for that escape hatch.

                      • steveklabnik10 days ago
                        > (maybe they've been fixed, maybe it was just a skill issue.)

                        Maybe! This is how Meta uses RA, and they sponsor development, and I know at least one of the people working on it and he really cares about getting things right, so if you run into it again, you should open up an issue.

        • xigoi10 days ago
          It encourages adding hundreds of dependencies to every project, taking up gigabytes of storage, making compilation slow and resulting in bloated binaries with potential vulnerabilities.
      • darthrupert10 days ago
        Everyone is entitled to opinions of course, but this is a rather weird one given how Rust's toolchain is the thing most people like most about it.
  • albertzeyer10 days ago
    > However, there should be no direct impact on users.

    I find this quite impressive, that they rewrote the whole Fish core, but everything keeps working exactly in the same way (except very few minor things which change in only minor ways, which they list).

    • nicce10 days ago
      If they managed to keep all the bugs as well and not to reduce them, that would be especially impressive.
    • kccqzy10 days ago
      I don't feel this is impressive. In Big Tech companies it's common for a team to rewrite an entire microservice without having any impact on users. Sure, a lot of that is for political reasons and unnecessary from a business perspective, and perhaps is selfish from a promotion perspective, but it's done very often.
  • nticompass10 days ago
    As a zsh user, I've been meaning to give fish a try. I keep adding plugins to zsh to make it act like fish (like command autocomplete) that I might as well try and/or switch to it.
    • giancarlostoro10 days ago
      My only annoyance with fish is when I copy bash one liners and forget, and get errors or issues. Otherwise, fish is fantastic.
      • porridgeraisin10 days ago
        There's a nice way to halfway-fix that issue. It makes use of the fact that most bash commands that we copy are prefixed with a $ and a space. It also requires your terminal emulator to have a way to hook into the paste mechanism and edit the to-be-pasted text. To my knowledge, Kitty and iTerm both have this feature.

        Basically, the terminal will replace each line of the pasted text that match (start with)

          $ rest
        
        with

          pbash 'rest_escaped'
        
        or more elegantly

          \$ 'rest_escaped'
        
        We will then define a function with either of these names in fish.

        This function will start (if not exists) a persistent background bash instance connected on both ends to FIFOs, with the same lifetime as your fish session. We then pass the `rest_escaped` to one FIFO, capture the output from the other FIFO, and echo it.

        Because its a persistent session, stuff you copy that makes use of variables or bash aliases all Just Work. Being able to blindly copy-paste the entire bash codefence from a github readme.md is especially nice.

        It all happens automatically after a one-time setup, and overall works pretty well for me. Here is a demo: https://i.imgur.com/HdqGkRk.png

        This is the fish function

          function \$
              if not test -f /tmp/bash_daemon.pid; or not kill -0 (cat /tmp/bash_daemon.pid) 2>/dev/null
                  echo "Starting bash daemon..."
                  bash ~/scripts/bash_daemon.sh &
                  sleep 0.5
              end
          
              echo "$argv" > /tmp/bash_daemon_pipe &
          
              while read -l line
                  if test "$line" = "###DONE###"
                      break
                  end
          
                  echo $line
              end < /tmp/bash_daemon_out
          end
        
        And this is the bash script `~/scripts/bash_daemon.sh`

          #! /usr/bin/env bash
          
          rm -f /tmp/bash_daemon_pipe /tmp/bash_daemon_out
          mkfifo /tmp/bash_daemon_pipe
          mkfifo /tmp/bash_daemon_out
          
          echo $$ > /tmp/bash_daemon.pid
          
          while true; do
              read cmd < /tmp/bash_daemon_pipe
              { eval "$cmd"; echo "###DONE###"; } > /tmp/bash_daemon_out
          done
        • xk39 days ago
          This is nice! But you should probably use $XDG_RUNTIME_DIR or /run/user/1000 instead of /tmp
        • giancarlostoro10 days ago
          Wow! This is fantastic! I will have to set this up ASAP.
    • gitaarik10 days ago
      Same situation, but I have the feeling that eventually I'll like the customizatability of zsh more than the convenience of Fish because I'm already too opinionated in my own configuration, and transferring to Fish might be more of a hassle than a gain. But who knows maybe someday it will be easier to customize Fish to my liking, but for now the ecosystem doesn't seem to completely fit my needs.
  • dgregd10 days ago
    A question for people who have already switched to the fish shell: What is the biggest drawback of using fish? For example, you get accustomed to it on your system and then have to work with Bash or Zsh on your company’s server systems. And if I’m going to make such a big switch from Bash to fish, then why not switch to Nushell instead?
    • timlyo9 days ago
      I use Fish as a user shell everywhere I can and end up using Bash daily for scripting and on servers/VMs/containers at work, I've also been using Nushell a lot recently for personal scripts.

      Biggest drawbacks for me is mixing up a few bits of syntax and some software doesn't ship Fish completion scripts, although I never write scripts in Fish which reduces the syntax I actually use.

      In my opinion Fish is worth it just for the auto complete suggestions alone, but I also really like the way it handles editing config, it's sane default config, understandable error messages, and plug-ins.

      Nushell is very nice, but I find it doesn't match the usability of Fish for interactive shells. Love it for scripts though.

    • iN7h33nD10 days ago
      Biggest drawback is unfamiliarity with the syntax, but that comes with time in my experience. I think the syntax is overall better and much better documented.

      I switched to fish because for most interactive use case it’s so much better, without requiring any new muscle memory. I tried zsh at first but it winds up slow to get even close to where fish is out of the box. I still end up scripting in bash or sh for portability.

      nu-shell won’t be available in as many places, and it looks to me like it would change paradigm in a way that would hinder working with bash or zsh over time. That’s just my 2c though as I have only briefly glanced at it and haven’t truly considered using it.

    • maleldil9 days ago
      The main drawback is that I'm used to all the goodness that comes by default and have to get used to how primitive Bash is when I'm forced to use it.

      I also prefer fish's scripting syntax (and built-in utilities) over bash, and some people don't like installing fish to run my scripts.

      Nushell is far from fish in terms of interactive usage, and I find the scripting language to be too unstable for writing scripts you want to keep in the medium term.

  • robin_reala10 days ago
    If you use Homebrew it’s not available there yet, but it’s being added. See https://github.com/Homebrew/homebrew-core/pull/209124.
    • apatheticonion10 days ago
      You can just get the binary from the github, it's just a single executable! Or compile it yourself with one command (cargo build --release)
      • Cthulhu_10 days ago
        That's fair but having a package manager manage all your dependencies makes maintenance and hygiene easier.
    • simon0410 days ago
      Nice, it has landed. Now I'm getting:

      > warning: Could not set up terminal for $TERM 'xterm-ghostty'. Falling back to hardcoded xterm-256color values

    • chanux10 days ago
      It has merged!
  • m00dy10 days ago
    I recently built my own shell to better understand its complexity and how it works under the hood. I also implemented redirections and partial tab completion. While I get that writing a shell isn’t the easiest task, I still don’t fully understand why there are so many different ones. I’ve been using the default shell on macOS, and so far, it works just fine.
    • t4356210 days ago
      The original one (bourne) had a great number of limitations and yet as part of a standard it didn't see much change.

      Everyone wanted something better and each person had an idea of what better was.

      bash became quite common because it's a superset and its' offered by GNU whose other tools made up for many other deficiencies in the various commercial UNIX implementations.

      Then FreeBSD and Linux made GNU stuff the default and that was a big boost.

      I tried fish couldn't really be bothered to persevere. A lot of the things I didn't like about bash were because I hadn't understood various bits and the more I know the more I find it fairly powerful and it has a kind of consistency. I don't love it but I found myself suddenly disempowered with things like fish.

    • mamcx10 days ago
      I go another notch: Why are so many different ones with so little major changes.

      If you experience the `shell` of FoxPro DOS or other tools you will see how poor are the ones we tolerate now. Is like we still live in the age of `ed`.

      (I even remember one of this projects have the joke that is finally a `terminal for the 90s!` or something like. Shells in common use a very poor things!)

      • specialist10 days ago
        Yup.

        Have you read Jef Raskin's The Humane Interface? It's an explainer and retrospective for his Canon Cat.

        I want more of that foundation, vision, concept.

        With the recent renewed interest textual user interfaces (TUIs), maybe this cycle we'll tact a little closer to that utopian future perfect omni-shell.

        https://en.wikipedia.org/wiki/The_Humane_Interface

        https://en.wikipedia.org/wiki/Canon_Cat

        https://en.wikipedia.org/wiki/Jef_Raskin#Pioneering_the_info...

        --

        And another thing (I say curmudgeonly)...

        bash (and csh), the progenator of all modern shells, is just one realization.

        Iteration and refinement are double awesome. We're seeing crazy awesome new variants, like Warp.app, oil shell, fish, and so forth. Yea for evolution!

        But I would also hope today's youngsters take a moment to review the genesis of all the modern ideas we now take for granted. From memory, in no particular order:

          Engelbart's Mother of All Demos
          Raskin's original vision for Macintosh
          Nelson's Xanadu
          Higgins art philosophy of "intermedia"
          Xerox PARC
          cybernetics
          Atkinson's HyperCard
          etc.
        
        The founders had motivations, insights, and ideas. Necessarily limited or ignored by feasibility. It's worth understand their ideas directly, for better or worse, not just thru subsequent intepretations.

        With 60+ years of progress and gestation, surely there are even more tangents worth exploring.

      • weakfish10 days ago
        It’s actually fish that has that tagline :)
      • pseudalopex8 days ago
        Most people reading this didn't experience FoxPro DOS probably. Why not say more?
    • Philpax10 days ago
      The second half of this comment reaches the opposite conclusion to what I would have expected from the first half.
    • jitl10 days ago
      Some people like nice things
    • johnnyjeans10 days ago
      different tastes.
  • oersted10 days ago
    I've used Fish for many years, but frankly only for the great autocompletion. The streamlined theme/prompt system and oh-my-fish plugin management are quite nice too, but minor.

    The rest of Fish features that are not bash-compatible are rather a pain, particularly environment variable management. In principle these features have a better design than in bash, but not that much better, and their use is infrequent enough to have to re-learn them every time. Unfortunately, they just end up being a minor inconvenience when you try to copy-paste setup instructions from docs, and I don't interact with these features otherwise.

    • rainingmonkey10 days ago
      It's the opposite for me; things that are intuitive in Fish would involve inscrutable magic incantations copied from StackOverflow in Bash.

      If you only want to use Fish for the autocompletion though, you can! Bash is always still there alongside Fish, you can just open a Bash shell when you're copypasting instructions, or `bash $SCRIPT` any scripts.

      • oersted10 days ago
        That's fair, and that's why I'm happy to keep using Fish. I suppose that I'd just prefer a leaner package and more focus on core features, but it's still my preferred option.

        It's just that I never find myself needing to do anything fancy in the command line. I just want it to be fast, ergonomic, beautiful and unobtrusive.

        And I wouldn't say it's because my workload is any simpler, I'm a relatively senior computer engineer working on large-scale data engineering, LLMs, non-trivial webdev and some systems programming in Rust. And it's not because I use UIs more often either, I use the command-line as much as anyone.

        I guess that I have more of a "RISC" approach to the command-line.

    • homebrewer10 days ago
      ZSH is pretty compatible and has great auto completion. The best thing for me is inline documentation (bash-completion only shows the list of available completions and you have to derive their meanings by yourself).

      It's also much easier to write your own completion scripts than for bash. The syntax is relatively sane, although fish completion scripts are much cleaner than bash or ZSH.

      Stick to plain ZSH to avoid losing performance on bloated mess like oh-my-zsh, add fzf to quickly dig through history and find files/directories, and it's really the best option we have.

    • linsomniac10 days ago
      This.

      I've been using fish as my primary shell for a couple years, primarily for the autocompletion. I started off with some zsh plugins that made the shell TOO fancy (and slow). I'd really like to see it be compatible but with some compelling improvements, rather than having them be just incompatible. Every time I can't do $() or fi... But for anything slightly complex I'll drop back down to bash rather than figure out the fish way to do it, because those things are rare enough that I have a hard time keeping them in my head.

      I guess I could ask an LLM how to do it in fish, but for things that I already have stuck in my head it's just easier to drop to bash.

    • BiteCode_dev10 days ago
      The better syntax used to be a selling point, but now with AI being able to generate any trivial one-liner and minor scripts you need on a day-to-day basics, have a bad syntax would only affect bigger projects, which I would not write in Fish shell anyway.

      It's a hard sell.

      • tomsmeding10 days ago
        Generative AI might be able to generate them, but it's still on you to understand the result and check that it indeed does what you want. And with the sometimes very nuance- or foot-gun-rich syntax of bash, that's rather a significant burden, if you're not familiar enough with the syntax to write the script yourself in the first place.
      • do_not_redeem10 days ago
        Speak for yourself, but I would not want to be beholden to AI for every trivial shell one-liner. "Sorry boss, ChatGPT is down, I can't count how many *.txt files are in this directory. See you tomorrow!"

        I'll take the better syntax, thanks.

        • nske5 days ago
          To be fair, even local, small language models fare pretty well in such things (both explaining and writing).
        • queuebert10 days ago
          Heaven forbid you read a man page. Even though Bash is weird, it's fully documented.
          • xigoi10 days ago
            Documentation is useless if you don’t know what to look for. Which manual page do I open to find out what :(){:|:&};: means without already knowing?
      • kibwen10 days ago
        Scripting languages are so dynamic, flexible, arcane, and subtle and the consequences for getting scripts wrong are so potentially catastrophic for a system that they are absolutely the last thing I would ever dare generate via LLM.
    • kccqzy10 days ago
      The great autocompletion is a great inspiration to me as well. It's intuitive in how it works and requires no user manual, although when you sit down to analyze it, it actually has some subtle states. It's such a great design that I essentially copied its UX to a web app I was working on: https://github.com/kccqzy/smartcal/commit/10d32d18d257d5093d...
    • ElectricSpoon10 days ago
      What I truly appreciate is the completion system from a dev perspective. Writing completions is comfortable. Even wrapping completions into other completions is fairly clean (e.g. sudo {cmd}TAB).
    • drcongo10 days ago
      Can I ask what you find difficult about the environment variables system in Fish? Personally I find it absolutely lovely to use.
      • sceptic12310 days ago
        When you don't use it all the time it's impossible to remember what all the flags are for. The names/scopes are also not helpful, I usually want universal, but think I want global because I don't remember there is a universal. And the thing I have to look up every time is how to set a variable for the current line.

        I'm not saying these are hard things, to figure out. I just agree that they're hard to remember when you don't use them all the time.

        • drcongo10 days ago
          I don't know if this helps at all but you can use `export FOO=bar` in Fish, and the prefixing a line with an envvar should work the same as in Bash etc. like `FOO=bar echo $FOO`
  • guytv10 days ago
    Can someone from the team share how the dev coordination for the Rust migration was handled? I only see a single PR (#9512)—how was the work organized?
  • pbronez10 days ago
    The rustport blog post says they lost support for Cygwin because it's not a supported Rust target. Looks like there is a fork for this:

    https://github.com/ookiineko-cygport/rust

    There have been discussions about adding the target to Rust, but they have not been pursued:

    https://github.com/rust-lang/rust/issues/79854

    https://github.com/rust-lang/rust/issues/5526

  • yencabulator8 days ago
    Tab completing "car" to "blkdiscard" just because I don't happen to have "cargo" in that $PATH is pretty nasty. How do I force tab completion to prefixes only?
  • OptionOfT10 days ago
    `clear-commandline` is an interesting one. It's a struggle between Windows and macos to maintain some form of consistency, and I failed to use Karabiner properly.

    I'll have to check later today what now the default `cancel-commandline` is set to.

  • xigoi10 days ago
    How much larger is the binary after rewriting it in Rust?
    • maleldil9 days ago
      The Rust version (4.0.0) has 73k lines of Rust, builds in 1m34s, and the binary is 4.3 MB.

      The C++ version (3.7.1) has 55k lines of C++, builds in 1m8s, and the binary is 2.4 MB.

      Both were built with CMake with default settings on a MacBook with M1 Pro.

      So, the new binary is 1.8x in size and takes 1.4x of the time to build.

  • ripped_britches10 days ago
    Bravo, love me some fish shell
  • diimdeep10 days ago
    Let's guess which one compiles slower
    • darthrupert10 days ago
      On my Macbook M1 Pro:

      - fish 4.0.0 / Rust: (cargo build): 16 seconds

      - fish 4.0.0 / Rust: (cargo build --release): 37 seconds

      - fish 3.7.1 / C++: cmake ..: 10 seconds + make -j8: 13 seconds = 23 seconds

      So yeah, C++ was slightly faster in release mode, but slower in non-release. I'd say this is yet another win for Rust, frankly.

  • 10 days ago
    undefined
  • 10 days ago
    undefined
  • 10 days ago
    undefined
  • queuebert10 days ago
    I was expecting issue #9512 "Rewrite it in Rust" to have been submitted on April 1.
    • Ygg210 days ago
      It's not too late for "Rewrite it in Zig" or "Rewrite it in Ada".
      • queuebert10 days ago
        Or "Revert back to C++" would be funny.

        Apparently no one around here has a sense of humor, though, since my original post was heavily downvoted. I greatly prefer Rust over C++, but "rewrite it in Rust" has become kind of a meme. And if you can't laugh at yourself, who can you laugh at?

        • 9 days ago
          undefined