7 ms·
Fish 4.0: The Fish of Theseus
- rsyring 2y ago[flagged]
- nemosaltat 2y agoMe too. I just keep watching the crustea-culting and wondering if I’m actually missing out.
- ykl 2y agoSo read this article, which is about exactly this?...
- nemosaltat 2y agoYes it is. I was on mobile definitely didn’t scroll far enough for the giant “Why Rust” where the TFA addresses my needless snark head on. > It’s tempting to try to sweep this under the rug because it feels gauche to say, but it’s actually important for a number of reasons. > For one, fish is a hobby project, and that means we want it to be fun for us.
- progbits 2y agoWell you are in luck because that is exactly what the article is about. ??
- rsyring 2y agoHa! I was in a hurry and misread this as the 4.0 release notes.
- petepete 2y agoReally happy to see this, such a mammoth effort by the team and everyone else involved. I switched over from zsh about four years ago and my config went from several hundred lines to a handful with just one plugin (fzf.fish). It just works how I expect it to and I can't imagine changing again any time soon.
- Spoof7726 2y ago> Fish also uses threads for its award-winning (note to editor: find an actual award) autosuggestions and syntax highlighting, and one long-term project is to add concurrency to the language. (note to editor: find an actual award)
- AndyKelley 2y agoit's a joke my friend
- syhol 2y agoThe two most popular zsh plugins are total clones of this at 31k and 20k gh stars respectively. Not an award but certainly an indication of its success.
- saghm 2y agoHaving used zsh with those plugins for a while and not having used fish personally, I'll nominate them for "most desirable plugins to copy for your own shell to make it more user-friendly".
- paradox460 2y agoThey should make an award, like RL Stein did https://x.com/RL_Stine/status/1337768882988347393 https://x.com/RL_Stine/status/1337768882988347393
- nosrepa 2y agoOr like any car award that oems advertise.
- dwattttt 2y agoSeriously, can someone find them an award? I think they've earned it.
- psd1 2y agoAchievement unlocked: Centurion! _get over 100 comments on hacker news_
- chubot 2y agoCongrats to the fish team! Great writeup with lots of interesting detail. I wonder if this is the biggest project that has moved from C++ entirely to Rust (or maybe even C to Rust?) It probably has useful lessons for other projects. If I'm reading this right, it looks like fish was not released as a hybrid C++ / Rust program, with the autocxx-generated bindings. There was a release during that time, but it says "fish 3.7 remains a C++ program" [1] It sounds like they could have released if they wanted to, but there was a last stage of testing that didn't happen until the end. Some people didn't quite get the motivation for adding C++ features to Rust [2], and vice versa, to enable inter-op. But perhaps this is a good case study. It would be nice if you could just write new Rust code in a C++ codebase, without writing/generating bindings, and then throwing them away, which is mentioned in this post. --- Also the #1 gripe with Rust seems to be that it supports version detection, not feature detection. But feature detection is better for distros, web browsers, and compilers: Feature Detection Is Better than Version Detection - https://github.com/oils-for-unix/oils/wiki/Feature-Detection-Is-Better-than-Version-Detection https://github.com/oils-for-unix/oils/wiki/Feature-Detection... Version/name detection is why Chrome and IE pretend to be Mozilla, and why Clang pretends to be GCC. Feature detection (e.g. ./configure and eval() ) doesn't cause this problem! [1] https://github.com/fish-shell/fish-shell/releases https://github.com/fish-shell/fish-shell/releases [2] e.g. https://news.ycombinator.com/from?site=safecpp.org https://news.ycombinator.com/from?site=safecpp.org
- Conscat 2y agoAlthough Clang does set the `__GNUC__` macro and you have to distinguish it using the `__clang__` macro, Clang and GCC also both have very fine-grained feature detection features as well, both at the CLI level and in the preprocessor (such as the `__has_feature` family of builtins).
- ComputerGuru 2y agoTo clarify, work on the rust rewrite started after 3.7.0, but the C++ code remained in a working branch on the git repo. Midway through the rewrite, we backported additions and improvements to fish scripts (most observable being new and improved completions) and a couple of important bugfixes from the rust-containing `master` branch to the C++ branch and released that as 3.7.1. We never considered releasing anything with a hybrid codebase; aside from the philosophical purity of fully making the switch to rust, it would have been a complete distribution nightmare (we take package maintainer requirements very seriously). Moreover, the code itself was not in a very pretty state - the port was very much like trying to undo a knot: you had to make it much uglier in order to get it properly undone. There were proverbial tons of SLoC that were introduced only for transitional interop purposes that were later removed, this code was never held to the same quality standards (in terms of maintainability; it was still intended to be bug-free and required to pass all our unit and integration tests, however). As mentioned in the article, we prefer to do feature detection when and where needed/possible. The old codebase was purely feature-detected via the CMake build system but we ended up writing our own feature detection crate for rust invoked via build.rs (maintained here [0]) though we just defer to libc on a lot (which doesn't do that yet). One side effect of the libc issue is that we're beholden to their minimum supported targets (though I'm not sure if that's strictly the case if we don't use the specific apis that cause that restriction?), which are higher than what we would have liked because we were fine with feature detecting and implementing using both older and newer apis where needed. [0]: https://github.com/mqudsi/rsconf https://github.com/mqudsi/rsconf
- scop 2y agoI remember switching from bash to zsh a few years back and thinking I was the bees knees. After the switch trying other shells seemed like bike-shedding because, I mean, what more could a shell? Then I got a new computer and decided to start from scratch with my tooling and downloaded fish. I was shocked how it instantly made zsh feel cumbersome and ancient. Heartily recommend others give it a try as a daily driver for a couple of weeks. I liken it to Sublime Text: an excellent “out of the box” tool. Just the right amount of features, with the option to add more if you want. But you also don’t feel like your missing out if you keep it bare bones. A great tool in and of itself.
- pzmarzly 2y agoInteresting, I went the other way about 7 years ago - switched from fish to zsh (initially with oh-my-zsh). The interactive experience was similar enough on both shells, and the performance was great on fish and okay-ish on zsh, but two things won me over: 1. With zsh, I can copy-paste some bash snippet and in 99% of cases it will just work. Aside of copy-pasting from StackExchange, I also know a lot of bash syntax by heart by now, and can write some clever one-liners. With zsh, I didn't need to learn everything from scratch. (I guess this matters less now that you can ask AI to convert a bash one-liner into fish one-liner?) 2. For standalone scripts... well, I think it's best to reach for a proper programming language (e.g. Python) instead of any shell language, but if I had to use one, I would pick bash. Sure, it has many footguns, but I know them pretty well. And fish language is also not ideal - e.g. IIRC it doesn't have an equivalent of `set -e`, you have to add `; or return 1` to each line.
- amluto 2y agoI think that oilshell is aimed at people like you. I’ve never used it, but their website does make some interesting points about how a shell ought to work and how this could be compatible with bash.
- kadoban 2y ago> 2. For standalone scripts... well, I think it's best to reach for a proper programming language (e.g. Python) instead of any shell language, but if I had to use one, I would pick bash. Sure, it has many footguns, but I know them pretty well. And fish language is also not ideal - e.g. IIRC it doesn't have an equivalent of `set -e`, you have to add `; or return 1` to each line. I'm sure you know this, but: no particular reason the interactive shell you use has to match the shell you use for scripts. All of my scripts are in bash, but I haven't used bash interactively in decades now, at least on purpose.
- freedomben 2y ago> The one platform we care about a bit that it does not currently seem to have enough support for is Cygwin, which is sad, but we have to make a cut somewhere. > We’re also losing Cygwin as a supported platform for the time being, because there is no Rust target for Cygwin and so no way to build binaries targeting it. We hope that this situation changes in future, but we had also hoped it would improve during the almost two years of the port. For now, the only way to run fish on Windows is to use WSL. I understand, but this is indeed incredibly sad. To this day I still use Cygwin, and in fact prefer it to WSL depending on what I'm doing. Cygwin is an incredible project that is borderline miraculous for what it accomplished and provides. Without Cygwin I may not have any sanity left. I can't exude enough love for the Cygwin team. Hopefully rust will support cygwin as a build target in the future!
- _zagj 2y agoIt's strange how the article starts off complaining about C++'s platform "issues": > We’ve experienced some pain with C++. In short: > tools and compiler/platform differences before conceding that, because of Rust, they 1) are actually dropping support for a platform they previously supported and 2) can only support (in theory) a small fraction of those platforms supported by g++, but that that's OK because those are the only platforms which really matter. I get that it's a trade-off, but it would have been more intellectually honest to just admit this is one area (portability, backwards compatibility, and ABI stability) where C++ mops the floor with Rust, instead of pretending it's a another paintpoint Rust avoids.
- aragilar 2y agoYeah, it's somewhat interesting that they point to Debian's popcon (which is opt-in), when the statistics are basically coming from amd64, whereas I think it would be much more interesting (if possible) to see what the number of installs of fish are on openwrt (and other embedded distros). Currently the openwrt fish install is ~2MB (which is massive on a router), I wonder what the new install size will be with the rust version, and if practically they've dropped everything except desktop/server linux and MacOS?
- epage 2y ago> The one goal of the port we did not succeed in was removing CMake. > That’s because, while cargo is great at building things, it is very simplistic at installing them. Cargo wants everything in a few neat binaries, and that isn’t our use case. Fish has about 1200 .fish scripts (961 completions, 217 associated functions), as well as about 130 pages of documentation (as html and man pages), and the web-config tool and the man page generator (both written in python). Our issue for this is https://github.com/rust-lang/cargo/issues/2729 https://github.com/rust-lang/cargo/issues/2729 Personally, I lean away from Cargo expanding into these use cases and prefer another tool being implemented on top. I've written more about this at https://epage.github.io/blog/2023/08/are-we-gui-build-yet/ https://epage.github.io/blog/2023/08/are-we-gui-build-yet/
- sunshowers 2y ago(hi Ed!) I would definitely love to see Cargo have the ability to do this -- it means that `cargo install --locked` stays as a viable approach. It probably won't apply to fish, but I think being able to run a post-install command from the binary you just installed would suffice for my needs.
- ComputerGuru 2y agoWe've actually added support to make single-binary fish deployments possible by (optionally) bundling static resources that would be part of the CMake-based deployment into the binary itself and having it unwrap those on first execution. The limitations of Cargo and the idiomatic `cargo install` usage primarily motivated this.
- sunshowers 2y agoAh interesting, I looked through your build.rs for the "installable" feature, and it looked like you were running sphinx-build in there. Do you plan to ship those artifacts in the .crate file?
- gorset 2y agoI'm a big fan of this solution! It's always been annoying to perform all the ceremony involved in deploying a system with a bunch of files, with config, scripts and system written in a bunch of different languages. In my current project I just wrote the installer and config generation as part of the main method. Gets rid of a lot of complexity, with a simpler build, and is arguably easier to maintain. Single language, single binary.
- OptionOfT 2y ago> it is often better to use if cfg!(...) instead of #[cfg(...)] because code behind the latter is eliminated very early My experience with this is the other way around, especially if you have crates tied to that feature. The cfg! is a marco that compiles to true/false, so whatever is inside of the if guard needs to compile regardless. E.g.: Cargo.toml [features] default = [] my_feature = ["deps:feature_dependency"] [dependencies] feature_dependency = "1.0.0" And in code: if cfg!(feature = "my_feature") { feature_dependency::something::Something::invoke(); } This will fail if you compile without `my_feature`.
- CGamesPlay 2y agoThat was the point. The paragraph is talking about how errors only show up in some configurations, leading to “works for me” behavior for some of the devs. When you can get away with cfg!, you are more confident that it will at least compile regardless of the config being checked.
- dajonker 2y agoI might be wrong but most optimizing compilers will treat "if false" and the following code as dead and remove it.
- Filligree 2y agoIt will remove it, but not until after resolving symbols. If the branch-never-taken references a missing library then this will still error, which is the problem for a feature flag.
- mplanchard 2y agoFairly sure you’re agreeing with what you quoted
- wellthisisgreat 2y agoIs fish better than Zsh?
- assbuttbuttass 2y agoIt's definitely better out of the box, with no configuration. If you add a bunch of fancy plugins to zsh then they can be very similar
- SMP-UX 2y agoIt's 'easier' for some people but you lose GNU bash compatibility and it kinda underlines all of the issues with interactive only shell systems -- a lack of interoperability. It's honestly a non-issue in the current year to learn zsh or tcsh
- ComputerGuru 2y agoOn the other hand, fish being a clean-room shell implementation not beholden to the baggage of legacy systems is immune to some crazy behaviors or vulnerabilities that other shells - including zsh - are prone to: https://yossarian.net/til/post/some-surprising-code-execution-sources-in-bash/ https://yossarian.net/til/post/some-surprising-code-executio... Compatibility has also come a long way in recent releases; you should give it a try.
- arp242 2y agoThey don't work in zsh; they're bash issues.
- faho 2y agoNo, they work in zsh, with one extremely small change: The referenced variable needs to exist. Try this (tested with zsh 5.9 on archlinux): foo='PWD[$(echo hahaha >&2)0]+42' [[ "$foo" -eq 5 ]] In bash, this would also print "hahaha" with "a" (or any other possible variable name) instead of "PWD", that's why many think it doesn't work at all in zsh. I'm pretty sure zsh has an optimization where it skips the indexing if the variable doesn't exist, which happens to sometimes stop this. But since you can just reference variables like PWD, that you know exist, it's not really a security improvement.
- WD-42 2y agoCongrats to the Fish team. The best shell just got better. How about updating the project tagline to: "Finally, a shell for the 00s!"
- ComputerGuru 2y agoThanks but one cannot be too ambitious like that! '00s would mean the end of zip drives, dealing with unstandardized flash drives flakier than the floppy disks of old, and supporting point-and-shoot digital cameras!
- nasretdinov 2y agoI guess the author meant "the shell for '000s", but that's too much to type
- WD-42 2y agoThat’s true. Better to stick to the 90s where we are safe.
- nixpulvis 2y agoAwesome to see. Can't wait to see how things improve from here. Here's the code if you were looking for it: https://github.com/fish-shell/fish-shell/tree/4.0b1 https://github.com/fish-shell/fish-shell/tree/4.0b1
- akdor1154 2y agoI'd be really interested to hear from distro packagers how this is going - how amenable is rust-fish to being packaged following e.g. Debian guidelines?
- zanchey 2y agoIt's hopefully not too tricky - it can't be packaged as a crate using (say) debcargo, as the install path still requires CMake. The Debian experimental package changes are mostly about pulling in the right dependencies (including some internal mangling to support some policy choices).
- ComputerGuru 2y agoWe took an incredible amount of care to consider the package maintainer requirements for our the most popular distributions using/distributing fish. One of our maintainers is very careful about letting us know when we're doing something that might upset distro packagers, and we're constantly letting package maintainer guidelines and requirements influence how we structure fish itself and which dependencies we pull in.
- akdor1154 2y agoAwesome - i guess i was trying to get at 'if upstreams co-operate, is it possible to package rust stuff nicely, or is it still a square peg/dpkg-shaped hole scenario?'. Sounds like the former, which is excellent. (Also thanks for putting so much work into maintaining fish - i have used it as a daily driver for years, and posts like TFA showing it's maintained so professionally impress me a lot!)
- eviks 2y ago> What would test -x say on Windows, which has no executable bit? It would say whether the file extension is executable (part of pathext env variable)
- pie_flavor 2y agoI should think it says the same thing as on Linux, since there absolutely is an 'executable bit' (GENERIC_EXECUTE) in the ACL.
- cute_boi 2y agoCongratulations. Rust is really a great language. I wrote a small rust web server and its been a year and it seems to work great on $5 vps without any issue.
- djaouen 2y agoGlad to see at least one Rust rewrite successful (unlike [1])! [1] https://github.com/remacs/remacs https://github.com/remacs/remacs
- preisschild 2y agoI would love to use fish, but it seems there really isnt a oh-my-zsh equivalent. I dont even need the OMZ prompt (i use starship for that), but the aliases from the kubectl and git plugins are just so great to have if you use kubectl and git often. Other plugins (like colored-man-pages, fzf-tab and syntax-highlighting) are also nice. Is there something like that for fish? Oh-my-fish has some of those features, but it seems to be abandoned.
- ComputerGuru 2y agoIntegration with 3rd party scripts and tools is often a single line in your config.fish, something like `foo --init-fish | source` or better yet, `command -q foo && foo --init-fish | source` We don't recommend oh-my-fish for various reasons, but I guess what's really missing is just a gallery.
- chisquared 2y ago> We don't recommend oh-my-fish for various reasons Care to elaborate a bit on those? Or is it the kind of thing that's impolite to discuss?
- dxxvi 2y agoHave you ever tried https://ohmyposh.dev/docs/installation/prompt https://ohmyposh.dev/docs/installation/prompt with fish?
- gothroach 2y ago[flagged]
- SMP-UX 2y ago[flagged]
- wiseowise 2y agoMeme language?
- titaniumtown 2y agomeme language? seems you dont have much constructive to say :p
- oguz-ismail 2y agoAnother rewrite? Hope it'll take off this time
- msoad 2y agoI love fish and I’ve been a user for years. In the wake of AI, I am really interested in getting out of completes via a local tiny AI model Does the fish team have any plans for integrating AI models for other completion?
- ComputerGuru 2y agoWe ship fish with completions ollama and llm, maybe others. We don't have any plans to "integrate" AI into the actual codebase.
- msoad 2y agoI had no idea! Where can I find docs to set this up?
- orf 2y agoTake some agency for yourself. https://github.com/search?q=repo%3Afish-shell%2Ffish-shell%20ollama&type=code https://github.com/search?q=repo%3Afish-shell%2Ffish-shell%2... That agency includes interpreting the search results alongside the reply to your original comment.
- msoad 2y agoYour snobby message didn’t help. This is for completion of ollama cli tool itself. I did search and couldn’t find the docs. Maybe the person responding to me also not understanding what I want. I want to prompt a tiny model for completion
- ComputerGuru 2y agoYou can do that in your own custom completion.
- orf 2y ago> Maybe the person responding to me also not understanding what I want By asking for the docs? If you found that file already then it’s clear they misunderstood what you are looking for, and also that what you are looking for doesn’t exist.
- underdeserver 2y agoThe tone in the "The Timeline" section seems apologetic: > The initial PR had a timeline of “handwaving, half a year”. It was clear to all of us that it might very well be entirely off, and we’re not disappointed that it was. I'm amazed that you estimated it at so little time originally, and I'm amazed you shipped it in full in just 2 years. Congrats!
- runiq 2y agoAbsolutely. Staying within an order of magnitude for a project of this size is just really good eyeballing. :)
- ComputerGuru 2y agoIt's actually not fair to judge this one way or the other at the two year mark. We technically removed the last C++ code from the core project in January 2024 (~a year ago), the last C++ code altogether (a test helper) in June 2024 (six months ago). We only decided to push out a release now because we've added enough new features (not counting the rewrite as a feature) to warrant a release. But at the same time, someone could argue that the current codebase is still far from being fully idiomatic rust, there are various C++-isms ranging from the use of UTF-32 (historical from the nature of std::wchar/std::wstring under *nix) to still passing around file descriptors rather than rust `File` objects (that will take a lot of rearchitecting to make mut-safe). Ultimately, a project is never "done" and we're not being paid at all let alone contingent upon completion of the port, so there's no real use in saying it took precisely this long or that long. We're releasing now because we want to, but I wouldn't tie the release cadence with the port timespan.
- estebank 2y agoThe UTF-32 thing was confusing me. It is mentioned in multiple places but never explicit if it was a temporary design decision to ease the transition, perfectly reasonable, or the design going forward in perpetuity, in which case I would love to understand why something like bstr (WTF-8 under the covers) doesn't fit the bill. I've gathered so far that it might be the former, but if it is the later I would still like to know more.
- LAC-Tech 2y agoI use the shell a lot every day, mainly bash and some ash (alpine). Does something like fish make the experience a bit smoother? is it pretty easy to get into?
- ComputerGuru 2y agofish is intended to be beginner friendly, whether you're new to the commandline world or not. It's essentially configuration-free, so that's about as easy to get into as you might imagine.
- kstrauser 2y agoSide note: beginner friendly or not, I've been using various kinds of shells for several decades and I still find Fish delightful. It's friendly to beginners, but also very comfortable to old salts.
- _lvbh 2y agoI have to ssh into different places quite frequently and keeping the zsh configuration synced was a pain. Fish had 95% of what I needed out of the box so rather than putting a ton of scripts in place, installing omz, plug-ins etc, I run a single install command.
- scottyeager 2y agoTo answer your first question specifically, yes. With fish you get substantial ergonomic improvements over bash and ash out of the box. There's also a very minimal learning curve since these features build on familiar idioms. There are some differences with fish as a language that take some getting used to, but bash is always one command away if needed for more complex stuff. It's absolutely worth a test drive to see if the features excite you. If the lack of bash familiarity is too much of a blocker, then zsh with plugins that provide the same features as fish might be worth a look too.
- LAC-Tech 2y agoset it to default on my laptop. the prompt was a bit noisy by default, and a bit too colourful, but it was very easy to configure. the autocomplete has also helped me out a few times already, much nicer than bash's
- nasretdinov 2y agoVery nice too see Rust being used where it is actually appropriate! Hopefully Rust "easy" multi-threading will allow more parts of fish to be async, even though it's already much better in that regard than bash (or any other shell I've seen). One weird thing I'd also like to see is more bash integration, as others pointed out that being their primary motivation against switching to fish full-time. My use case is mostly sourcing bashrc/bashevv, and theoretically it should be possible in fish if I understand correctly: you need to be able to import e.g. every new env variable that changed before and after sourcing a bash script via real bash.
- outlore 2y agoI am curious to ask others here, are there other low-config alternative tools like Fish that, looking back, now seem like a no brainer? Ghostty is a recent example, Helix seems like another. I’d love to know about other tools people are using that have improved or simplified their lives.
- datadeft 2y agomise, uv, ruff, starship is my current list.
- nindalf 2y agoAgree with you on helix. I love it. Atuin for improved history search. Starship for an improved shell prompt. zoxide - better cd ripgrep - better grep just - a command runner. I put project specific commands/scripts in there so I don’t have to remember. All of these are indispensable for me.
- lawn 2y agofd a better find is one I like.
- ComputerGuru 2y agoimho starship is really just eye candy for the shell; it's not necessarily an actually improved shell prompt if you're on a "modern" shell like fish (a shell for the '90s!) or if you've put effort into customizing your shell experience with any of the other shells.
- nindalf 2y agoI’m on zsh and it’s definitely an upgrade for me. I want to say though, great work on this migration! Really fantastic work that others can learn from when they try a similar migration.
- anthk 2y agoCD is builtin, there's no better cd.
- deleted 2y ago[deleted]
- Too 2y agoSurprised to see the line count go up so much, 56K LOC of C++ to 75K of Rust. The blog attributes it to rustfmt using less oneliners. Even so, i would believe that should be a small factor compared to the heaps of duplicate code you get from c++ header files and all the other syntax ergonomics rust gives you. Is this typical for such a translation. They also mention addition of new features contributing to more code, how much of the addition was new features vs pure translation? Would be interesting to see the line count of the c++ version if it was run through a formater with similar configuration.
- pornel 2y agoRust is denser than C, but both Rust and C++ can work on similarly high level of abstraction. It may be just down to rustfmt. It really adds a lot of vertical sprawl. I personally can't stand how much rustfmt makes multi-line code explode.
- metaltyphoon 2y agoDefault to 80 chars is a travesty IMO, 100 or 128 would be a much better place.
- pornel 2y agorustfmt uses 100-char lines by default (and can be configured to fill more), but that's not the problem with it. The problem is that as soon as a whole statement doesn't fully fit on a single line, rustfmt switches from "horizontal" to "vertical" strategy. It then stops caring how much vertical space it takes, inserts line breaks as often as the style allows, and won't try to use the available line width. You end up with long runs of finely chopped lines that contain only a single variable or a single call (often with each argument on a separate line too), which looks like having a 20-char line length limit. It's either fully oneliner `foo().bar().baz()` or fully vertical foo() .bar() .baz(); and you can't have anything in between. It will fight you if you put two calls on the same line.
- 2y ago
- gorgoiler 2y agoI try not to post unsubstantive comments here but I’m just so moved by this success that I have to say an enormous Congratulations!
- djoldman 2y ago> 57K Lines of C++ to 75K Lines of Rust ... > 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, like: ... I wonder what the character count diff is?
- ComputerGuru 2y agoSo the problem with character counts is that unless you put in an insane amount of effort to calculate it, you're not going to get "significant chars" but rather "bytes" That said, you asked so here's the result of the difference within the `src/` directories comparing 3.7.1 and 4.0 beta (so excluding docs, fish scripts, etc): > cd fish3/src; find . -type f -exec cat {} + | tr -d '[:space:]' | wc -c 2172330 > cd fish-shell/src; find . -type f -exec cat {} + | tr -d '[:space:]' | wc -c 2207996 That's an increase of 35,666 bytes, or just 1.6% If you don't exclude whitespace, the difference is just under +250k bytes (an 8% increase).
- naurupatel 2y agoWe're flush with new and awesome terminals lately, Ghostty public launch now a huge upgrade to fish. I've tried Fish a few times but hard to migrate over from bash/zsh. Does anyone have tips on how to port over a bunch of aliases/scripts/etc. easily?
- andrewshadura 2y agoYou don't need to port your scripts. Migrating aliases shouldn't be too difficult.
- memco 2y agoThought for a second that this was a 4.0 release announcement but this is just about the rewrite in rust. Any fish users wanting release notes of what to look forward to can look here: https://fishshell.com/docs/4.0b1/relnotes.html https://fishshell.com/docs/4.0b1/relnotes.html. Glad the rewrite is helping the dev team make improvements, but I’m more excited for the actual new features (except the new alt-backspace behavior which I’m sure I’ll get used to).
- apatheticonion 2y agoCan I `source` my custom .bash_profile file into Fish? Trying it out it doesn't seem to work
- LorenzoGood 2y agoNo, they aren't compatible.
- chris_wot 2y agoWow, amazing! I wonder how a conversion of a C++ project that makes extensive usage on ranges would go.
- rmac 2y agofish > zsh > bash > *
- qalmakka 2y agoAs a decade-long user and as a professional C++ developer, I'm so happy they've managed to successfully port the shell to Rust. While I have a lot of fun writing C++ (and Rust), I must admit that Rust is vastly nicer to use. People can complain as much as they want about the borrow checker, but you basically have to be as strict as Rust is in C++ if you want to really avoid use-after-free issues, ... I've been writing "Rusty C++" since before Rust was a thing, because that's the only sane approach to memory safety. I'd rather have a program check that I don't fumble up instead of running sanitizers when things go awry (often years later). The best bug is a bug that can't happen at all. Static analyzers are sadly too limited compared to what a borrow checker can do in my experience. Some bad stuff will always slip in in C/C++.
- bad_username 2y agoWhat is you "rusty C++"? The only thing I can think of is strict adherence to RAII.
- abbefaria27 2y agoAmazing write up! Everyone at work is itching to try Rust, but I think what’s killing adoption is that it’s not very clear how to gradually transition a code base. We have a few million lines of C++, some of it written 25 years ago. A full rewrite is just out of the question, at best we could use it for new sections. This is super common in the c++ world, so it’s a pity that porting wasn’t a first class concern in rust considering C++ devs are the target audience. It sounds like it was a challenge even at 57k LOC. Congrats to the fish team though, great accomplishment!
- jpc0 2y agoIf you codebase isn't somewhat modern C++(C++11) I would start there before concidering a port to rust. It will be a significantly easier upgrade in safety even if not going all the way to rusts level of safety. Generally code that has been running for years is unlikely to have too many bugs since they have been shaken out, "rewrite it in Rust" as a fad just ignores the decades of work already put into the codebase and for large codebases likely eont succeed. As you mentioned, write new modules with rust. That means likely needing to export a C API for your libraries but there's a good chance you were already doing that. There was also a rust crate that tried to automate most of the c++ rust interop for you but not sure about how good it is in reality.
- jedisct1 2y agoFor end users who don't care much about the internals, what are the new features of Fish 4.0? Anything worth the upgrade from Fish 3.0?
- robertlagrant 2y agoChanges are in the release notes: https://github.com/fish-shell/fish-shell/releases/tag/4.0b1 https://github.com/fish-shell/fish-shell/releases/tag/4.0b1
- jsx2 2y agoIt seems the upgrade to 4.0 isn't available from Homebrew yet (brew upgrade fish -> Warning: fish 3.7.1 already installed)
- hogdanish 2y ago`git -C (brew --cache --HEAD fish) fetch --tags` and `brew install --HEAD --fetch-HEAD fish` seems to do the trick for now, just be prepared to wait awhile for it to build