Live data from Hacker News

Fish 4

github.com

61–70 of 113 posts

Re: Fish 4

#61
post #43

Earlier quoted context omitted.

[flagged]

Why would you care what it's written in at all, unless you plan to work on it yourself?

In a sense why should anyone care about this article? It's a shell, why is rewriting it in Rust noteworthy?

Re: Fish 4

#62
post #12

Earlier quoted context omitted.

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.

Efficient LOC shouldn't be a goal or metric anyway, readability trumps conciseness... except when conciseness improves readability.

Agreed. I would rather be forced to explicitly cover all match cases than accidentally run into problems that are hard to debug.

Re: Fish 4

#63
post #30

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.

The second half of this comment reaches the opposite conclusion to what I would have expected from the first half.

Re: Fish 4

#64
post #8

Earlier quoted context omitted.

I'll be curious if it's faster.

Faster than previous C++? Only if there were actual performance bugs that they fixed while doing the port.

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.

Re: Fish 4

#65

Earlier quoted context omitted.

Efficient LOC shouldn't be a goal or metric anyway, readability trumps conciseness... except when conciseness improves readability.

Agreed. I would rather be forced to explicitly cover all match cases than accidentally run into problems that are hard to debug.

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

Re: Fish 4

#66
post #61
post #43

Earlier quoted context omitted.

Why would you care what it's written in at all, unless you plan to work on it yourself?

In a sense why should anyone care about this article? It's a shell, why is rewriting it in Rust noteworthy?

Only noteworthy if it was done using or now features a LLM :D

Re: Fish 4

#67
post #30

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.

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.

Re: Fish 4

#68
post #8
post #4

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

I'll be curious if it's faster.

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

Post reply on HN