Live data from Hacker News

Fish 4.0: The Fish of Theseus

fishshell.com

161–170 of 204 posts

Re: Fish 4.0: The Fish of Theseus

#161

I'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?

We 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…

Awesome - 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!)

Re: Fish 4.0: The Fish of Theseus

#162
post #103
post #93

Surprised 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,…

Rust 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.

Default to 80 chars is a travesty IMO, 100 or 128 would be a much better place.

Re: Fish 4.0: The Fish of Theseus

#163
post #32

Earlier quoted context omitted.

I went bash -> fish -> zsh. The main reason I switched is because zsh can (often) source bash scripts and can use bash completion scripts (usually), and I was tired of having to translate things from bash to fish. I also ran into a few things where something that was relatively easy to do in bash was impossible to do with fish. But that was years ago so maybe that is less of an issue now, and I don't remember exactly…

I used bash for ages, and never really saw what zsh offered in comparison: I would have had to customize it almost as much as bash, and it didn’t really give me anything new. Fish was so much better than either out of the box, and I still have done virtually no configuration other than setting it up to use my common starship prompt, which is supported in bash as well. I don’t understand personally the argument about…

> I don’t understand personally the argument about not having bash syntax.

Three main reasons:

1. The Fish language is only useful only for somehow extend fish itself, so it is pointless to spend time learning and practicing it unless I'm writing something for me or other Fish users.

2. Sometimes we need to copy and paste something to our shell. When using Fish I must remember to set variables with set, get the status code with $status instead of $?, use () instead of $() and so on, which is a unnecessary overhead

3. Bash's syntax is a hell: sometimes we forget a space, an escape, use end or done when we need to use fi or esac and so on. I don't trust my Bash code, I type everything in the terminal to check if everything is ok. In Fish I just can't do that...

> If I want it, I just run `bash`

That's what I do for 2 and 3. But when I do that I don't have the nice features of Fish...

I still love Fish, though.

Re: Fish 4.0: The Fish of Theseus

#164
post #21

Earlier quoted context omitted.

Do you mind sharing what you think are the killer features of fish?

Fish has a lot of features out of the box I find really useful: * Command auto suggestions as you type based on your history * History search (using up arrow) based on a partial command * Helpful completions and descriptions when you hit TAB * Muti-line command editing * Syntax highlighting You can get all those same features in Zsh by using plugins, but those features work out-of-the-box with Fish with zero configur…

Other two things: Fish has an amazing integration with Docker and Git. If you type:

docker stop

it suggests the hashes of the containers. About Git, you can, for example, type:

git checkout

and Fish will suggest the available commits and tags. If you start to type a string it will also suggest the hash of commits whose messages match the string.

I know that zsh may do the same using plugins. But Fish have all of that by default without being bloated. I use Fish since 2018, never installed a plugin and never thought that something was extra in it

Re: Fish 4.0: The Fish of Theseus

#165

Is fish better than Zsh?

It depends on what you consider "better". ZSH out of the box is not much more than Bash, while Fish has really nice features without any configuration. But I think that the ZSH community is more mature and ZSH is compatible with Bash syntax (while Fish has its own syntax).

Just install it and see if it's for you.

Re: Fish 4.0: The Fish of Theseus

#166
post #86

I 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.

Chezmoi was a complete workflow changer for me. https://www.chezmoi.io/ Let's me manage/synchronize my configs between systems. It has built in variables and scripting support so you can ignore sections of files or specific sections of files on certain systems, write specific configs for specific systems based on hostname or OS. It's a bit of work to get an understanding of, but incredibly powerful once you do.

Whenever I setup a new system now, I install chezmoi, clone my comfig repo and then initialize it and it uses the chezmoi scripts to automatically installs all my programs and copies in the needed config files.

Re: Fish 4.0: The Fish of Theseus

#167

I 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…

Integration 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.

> 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?

Re: Fish 4.0: The Fish of Theseus

#168
As 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++.

Re: Fish 4.0: The Fish of Theseus

#169
post #103

Earlier quoted context omitted.

Rust 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.

Default to 80 chars is a travesty IMO, 100 or 128 would be a much better place.

rustfmt 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.

Re: Fish 4.0: The Fish of Theseus

#170
Amazing 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!
Post reply on HN