this post was submitted on 30 Jul 2024
104 points (96.4% liked)

Rust

6130 readers
83 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 2 years ago
MODERATORS
top 20 comments
sorted by: hot top controversial new old
[–] Ephera@lemmy.ml 41 points 4 months ago (2 children)

the port does not have any immediately benefits to end-users or gives us any new special features. However, it improves the future maintainability and bug-fixing capability of the dev team compared to the C++ base.

I remember them also specifically talking about an issue regarding asynchrony. If I remember correctly, it was that their current job system doesn't actually execute background jobs in parallel. They even had a massive pull request ready to fix this in C++, but did not feel confident in it not introducing a ton of bugs.

But the most important reason is fun. Fish is a hobby project. The core team wanted to switch to Rust, because it would be more fun. This also resulted in tons of new contributors suddenly offering help. So many people trying to find "rational" explanations like you'd expect them from a company, when completely different dynamics apply in a volunteer project.

[–] asdfasdfasdf@lemmy.world 20 points 4 months ago (2 children)

What's interesting to me is that IMO Rust is fun because of legit, pragmatic benefits. E.g. I don't think debugging runtime errors is fun. Seeing all the compile time stuff Rust catches is fun for me. My employer doesn't care what's fun, but they do care about me shipping features instead of bugs, so we're kind of on the same page.

[–] ProtonBadger@lemmy.ca 16 points 4 months ago

Yeah, I’ve done C++ for a couple of decades. So much less time is spent debugging with Rust, I love it. We have powerful processors and compilers, they’re meant to do tedious work for us, might as well let them do more to ensure “correctness” for us.

Besides I love the simple things like Option and Result.

[–] Ephera@lemmy.ml 10 points 4 months ago* (last edited 4 months ago)

Yep. Where I notice it the most is frontend stuff. We've been using a WebAssembly framework, particularly Leptos, where you get to write HTML+CSS+Rust.

And normally, a colleague and I despise frontend, i.e. JavaScript. Like, it's kind of cool, because you get a visual result, but the crimes against humanity you have to commit in terms of code readability were very visible to us.

And yeah, Leptos and Rust are a lot better in that regard, which boosts productivity. Particularly when a backend request fails, you get a Result, which you can pass as one value to the display code and just display either the data or an error. That's huge, because you make a lot of backend requests.

One downside in productivity and fun is that there obviously aren't yet as many component libraries, so if you want a toast notification, you might need to implement that yourself.

But still, we almost had to seriously ask that colleague to pause dishing out frontend features, because he was enjoying it so much.

[–] tyler@programming.dev 5 points 4 months ago

They’re not immediate benefits. It allows them to implement an oft asked for feature that was not possible with the previous codebase.

[–] faho@lemmy.world 8 points 4 months ago (1 children)

I still don't know what the fuck they mean by "make it available for servers".

They said that in the earlier post too and I have no clue how they came up with that.

[–] nous@programming.dev 20 points 4 months ago (1 children)

They said on a linked post:

Make fish available on servers that run old LTS distros Making it easy to build and run

Which suggests to me they are using features from newer versions of libraries then exist for older LTS distos. Making it hard to compile and run on them. Most of rust libraries are statically compiled so that is not an big issue for rust. Though this is just speculation on my part.

[–] faho@lemmy.world 8 points 4 months ago* (last edited 4 months ago) (2 children)

There is nothing specific in the rust port that makes fish more available for servers or LTS distros.

Before, you would have had to get a C++11 compiler (which used to be a bit of a PITA until 2020 or so), now you need to get rust 1.70 (which isn't terrible given rustup exists).

I see they're taking it from this comment, which says

Fish should be available on servers, which run old LTS distros - this means we build our own packages for a variety of them.

Which is something that fish has always done - you can go to https://fishshell.com/ and get packages for Ubuntu, Debian, OpenSUSE and CentOS - all server distros, and these packages are built by the fish developers, not the distros.

That quote comes from the "Setting The Stage" section of the comment, which describes the status quo. This is about explaining what fish does and needs from a new language, not about something that fish wants to achieve by switching the language.

[–] BatmanAoD@programming.dev 7 points 4 months ago* (last edited 4 months ago) (2 children)

There is nothing specific in the rust port that makes fish more available for servers or LTS distros.

Being written in Rust does improve availability, because by default Rust statically links against everything except libc, and you can opt out of that if necessary. So there is inherently no need to build separate dependency packages for each distro, unless you use a Rust crate that specifically links to a C or C++ library.

[–] FizzyOrange@programming.dev 4 points 4 months ago (1 children)

It actually statically links the Rust standard library too. You can also avoid glibc by using musl with a one line change.

[–] BatmanAoD@programming.dev 3 points 4 months ago

Oh, right, yes; of course it statically links the standard library. I was thinking of the fact that the standard lib is precompiled, but yes, it's statically linked.

[–] faho@lemmy.world 2 points 4 months ago* (last edited 4 months ago) (1 children)

fish links against pcre2, which is a C library (via the pcre2 crate).

(it used to also link against ncurses, now it uses the terminfo crate instead, which just reads the terminfo database in rust)

Of course there is a way to make fish distributable as almost a single file (https://github.com/fish-shell/fish-shell/pull/10367), which rust does make easier (rust-embed is frickin' cool), but these sorts of shenanigans would also be possible with C++ and aren't really a big driver of the rust port. It's more that cargo install would try to install it like that and so why not make that work?

Really, my issue here is that the article makes "making fish available on servers" this huge deal when fish has always been available on servers?

[–] BatmanAoD@programming.dev 1 points 4 months ago

The phrasing "available on servers" does seem quite weird. It does seem that having a single, standalone binary is much easier with Rust than with C++, though.

[–] FizzyOrange@programming.dev 2 points 4 months ago (1 children)

I think the point is that Rust will make it easier to distribute portable binaries. You can use Musl and then you get a completely static binary with no dependencies that works on old versions of Linux.

You can achieve the same with C++, but it's waaaay more hassle.

[–] faho@lemmy.world 3 points 4 months ago (1 children)

There is the point you can make, which is that you can more easily create self-contained statically linked binaries (tho fish needs more than what cargo itself can provide here because it ships a ton of data files, see https://github.com/fish-shell/fish-shell/pull/10367),

and then there's what this site keeps claiming from a misreading of a comment I made when the port just got started, which is that fish is now "available on servers". Which is just wrong, it's always been available on servers and it's been easy to install a new fish on LTS distros for users for ages.

[–] FizzyOrange@programming.dev 2 points 4 months ago

Yeah you're right that comment doesn't make any sense.

[–] Kolanaki@yiffit.net 5 points 4 months ago

Beta release

IDK if this means early-ish software or if it will release the fish of the same name. 🤔

[–] catnip@lemmy.zip 5 points 4 months ago

As a fish user and a rust user this is awesome

[–] hardaysknight@lemmy.world -4 points 4 months ago* (last edited 4 months ago) (1 children)

Almost ready for a beta

Really?

[–] runiq@feddit.org 5 points 4 months ago* (last edited 4 months ago)

This is a big, established project undergoing a complete rewrite. A beta is definitely warranted, no?

Edit: Typo