Nice to see fish RiiR moving forward (aus.social)
from snaggen@programming.dev to rust@programming.dev on 21 Nov 2023 10:19
https://programming.dev/post/6191978

#fishshell rewrite-it-in #rust progress, 2023-11-20

76909 rust lines added

48105 / 77063 C++ lines removed

â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘ 62 %

#rust

threaded - newest

technom@programming.dev on 21 Nov 2023 11:00 collapse

I wonder what sort of problems they had with C++ that prompted them to port such an old codebase to Rust.

[deleted] on 21 Nov 2023 13:59 next collapse

.

technom@programming.dev on 22 Nov 2023 03:48 collapse

Not really. Rewriting something in Rust has some obvious advantages. But those advantages diminish with the age of the old code base. For example, the biggest advantage is memory safety. But old C or C++ code bases would have undergone so much real world use and testing that most of the memory safety bugs would have been corrected anyway. Similarly, the new code (in Rust in this case) may fail to capture lessons from the old code that may not be well documented.

For these reasons, the common approach followed is to wrap old code in safe Rust and use it, instead of completely rewriting it in Rust. This was a stated objective (C & C++ FFI) of Rust project since its early days. This is also the reason why core Rust team often doesn’t support the RiiR zealotry.

In this case though, the developers of fish themselves decided that the hassles of C++ is worse than completely rewriting such a big and old code base in another language. I’m interested in C++ as well, though Rust is my primary language these days. I thought that it would be interesting to hear the experience of someone who made this unusual decision after dealing with both languages.

BB_C@programming.dev on 21 Nov 2023 15:39 next collapse

Most specific and technically relevant point:

  • Rust is what we need to turn on concurrent function execution.

You can read more in the RIIR PR.

Knusper@feddit.de on 21 Nov 2023 17:44 collapse

This comment is probably the most interesting (from the PR that was already linked): github.com/fish-shell/fish-shell/pull/9512#issuec…