Fish rewrite-it-in Rust progress: 100% (aus.social)
from Chewy7324@discuss.tchncs.de to linux@lemmy.ml on 16 Jan 2024 13:29
https://discuss.tchncs.de/post/9365035

plan for the now completed port of fish to rust

#linux

threaded - newest

Urist@lemmy.ml on 16 Jan 2024 13:43 next collapse

Seems one of the main reasons is to use Rust’s thread safety to enable “concurrent mode”. Anyone with the knowledge able to explain what advantages that would yield for an end fish user?

technom@programming.dev on 16 Jan 2024 14:02 next collapse

Here’s one issue they hope to solve with this rewrite: github.com/fish-shell/fish-shell/issues/238

bizdelnick@lemmy.ml on 16 Jan 2024 23:12 next collapse

End user shouldn’t care what PL the software is written in. Their advantages and disadvantages are meaningful for developers only.

Nyanix@lemmy.ca on 17 Jan 2024 00:29 next collapse

While I agree, most people shouldn’t have to be concerned with it, you can’t deny the resource impacts of various languages, libraries and frameworks, like compare the memory usage of Discord or Teams with those of FOSS chat applications, and you’ll notice those two consistently eating much more memory. You can also compare compute speeds of a higher level language like Python vs lower level languages like Rust and you’ll find that Rust is quite a bit faster (though generally takes more dev time). So yes, users shouldn’t have to be concerned with involved languages, but if you’re running something on a low-resource device, such as a Raspberry Pi, those little details can make all the difference.

Falcon@lemmy.world on 17 Jan 2024 03:23 next collapse

PL can have a large impact on features, bugs, bug reports, troubleshooting, performance and documentation. Particularly when dev resources are limited.

It’s hard to see how this opinion holds any water.

Rust is a great choice for a shell built as an interactive shell that doesn’t have to be core to the OS. Over C++ this also makes development more accessible to young programmers.

conciselyverbose@kbin.social on 17 Jan 2024 12:32 collapse

Except they affect the end result.

faho@lemmy.world on 18 Jan 2024 12:38 collapse

One big, long-standing issue is that fish can’t run builtins, blocks or functions in the background or at the same time.

That means a pipeline like

seq 1 5 | while read -l line
    echo line; sleep 0.1; 
end | while read -l line
    echo line; sleep 0.1
end

will have to wait for the first while loop to complete, which takes 0.5s, and then run the second.

So it takes 0.5s until you get the first output and a full second until you get all of it.

Making this concurrent means you get the first line immediately and all of it in 0.5s.

While this is an egregious example, it makes all builtin | builtin pipelines slower.

Other shells solve this via subshells - they fork off a process for the middle part of the pipeline at least. That has some downsides in that it’s annoyingly leaky - you can’t set variables or create a background job in those sections and then wait for them outside, because it’s a new process and so the outer shell never sees them.

Tb0n3@sh.itjust.works on 16 Jan 2024 13:59 next collapse

These rewrites in rust are merely just training exercises for those doing it. It wasn’t needed and in most cases isnt used.

atzanteol@sh.itjust.works on 16 Jan 2024 14:23 next collapse

They did it “for the vibes”

Vibes are just as important to free/open source software as proprietary software and although there were solid technical reasons for the port, the PR outcomes are added benefits.

anteaters@feddit.de on 16 Jan 2024 14:43 next collapse

Angry downvotes because people don’t like to hear that a meme language is a meme language.

vsis@feddit.cl on 16 Jan 2024 14:54 next collapse

Meme language? It was not rewritten in Javascript.

acwern@sh.itjust.works on 16 Jan 2024 15:08 next collapse

Probably not “angry” downvotes. OP provided a link where it’s explained exactly why the switch was made. Even if you don’t care for Rust it’s pretty clear that this was done with more purpose than just “Ooo let’s make it in Rust for fun”

Ephera@lemmy.ml on 17 Jan 2024 12:15 collapse

And even if it was for fun, that would still be valid. The project is run by volunteers. If they don’t have fun, they stop doing it.

conciselyverbose@kbin.social on 16 Jan 2024 18:43 next collapse

You clearly don't know what a meme language is.

ParetoOptimalDev@lemmy.today on 16 Jan 2024 18:59 collapse

Didn’t this “meme language” ship in a recent Linux kernel?

Deebster@programming.dev on 16 Jan 2024 15:41 next collapse

Large parts of the rewrite came from contributors who had never worked on fish before.

That’s pretty useful alone.

And there’s this:

Thread Safety

Allowing background functions and concurrent functions has been a goal for many years. I have been nursing a long-lived branch which allows full threaded execution. But though the changes are small, I have been reluctant to propose them, because they will make reasoning about the shell internals too complex: it is difficult in C++ to check and enforce what crosses thread boundaries.

This is Rust’s bread and butter: we will encode thread requirements into our types, making it explicit and compiler-checked, via Send and Sync. Rust will allow turning on concurrent mode in a safe way, with a manageable increase in complexity, finally enabling this feature.

ParetoOptimalDev@lemmy.today on 16 Jan 2024 19:01 collapse

It was needed to safely further support for concurrent features? If they follow through on adding that support, there will likely be adoption.

The problem is in most cases the implementers stop at “same thing but in rust” without taking advantage of that.

I can’t fully blame them since just duplicating an existing thing is a huge undertaking.

Sibbo@sopuli.xyz on 16 Jan 2024 14:26 next collapse

Wow they actually did it! Congratulations and welcome to the age of second-gen systems languages!

PropaGandalf@lemmy.world on 16 Jan 2024 15:35 collapse

Now we have nu and fish. Great!

Laser@feddit.de on 16 Jan 2024 15:52 collapse

Interesting that you mention it. I mainly use fish but always do some stuff in nu to check out its progress. They are in my opinion the two most interesting interactive shells at the moment that I know of, the third shell I keep an eye on is oil but rather as a replacement for bash when used in scripts rather than interactive. The project also has ysh which also doesn’t look too bad and seems to go in a similar direction as fish.