News for hackers. Stuff that matters.
Re:How to not rewrite it in Rust by adrianmonk on Wednesday October 23, 2019 @11:35AM (#21335692)
> at best, the temptation to RiiR is unproductive

I think there are probably three cases here:

(1) You have perfectly good software and your only motivation to rewrite is infatuation with how great Rust seems. In this case, yes, that's unproductive. (Infatuation-driven design is poor engineering and is a fairly widespread problem in the software industry.)

(2) You already have other reasons to want to rewrite (design could be improved, code is in a poor state, etc.), and you're deciding between languages. In that case, a rewrite could be productive even if you didn't use Rust.

(3) You have mature software that appears relatively free of obvious, known bugs, but it's written in an unsafe language, and it would be valuable to have the additional confidence that a safe language could provide. Security-sensitive or other critical applications are where this is most likely to make sense.

Re:How to not rewrite it in Rust by Skunkleton on Wednesday October 23, 2019 @02:33PM (#21337433)
(4) You want to develop new components in rust, but it has to integrate with your existing components somehow.
Re:How to not rewrite it in Rust by pyython on Wednesday October 23, 2019 @03:54PM (#21338243)
How about (5) you're trying to learn Rust and you need a project to work on? Irresponsible for production code, but perfectly valid for a weekend project. And in my experience can be a great way to learn the quirks of a particular language!
Re:How to not rewrite it in Rust by zbentley on Wednesday October 23, 2019 @03:01PM (#21337714)
Why not use ffi for this case? Many languages have robust support for linking to Rust code.
Re:How to not rewrite it in Rust by gameswithgo on Wednesday October 23, 2019 @03:38PM (#21338095)
yeah sometimes that makes sense. if the lib in question in small enough it might be more valuable to port, so avoid having a multi language project, and avoid the effort of the ffi.

at least Rust -> C ffi is zero cost (usually)

Re:How to not rewrite it in Rust by viraptor on Wednesday October 23, 2019 @08:41PM (#21340571)
Having everything available in Rust code also means you don't have to do lots of extra work for cross-compilation.
Re:How to not rewrite it in Rust by saagarjha on Wednesday October 23, 2019 @11:45PM (#21341486)
How does Rust help you if you have to cross-compile?
Re:How to not rewrite it in Rust by viraptor on Thursday October 24, 2019 @06:23AM (#21343156)
You can compile rust in one go. If you rely on native libraries, you need to be able to link them during cargo build and that's painful to set up. Not impossible... just really annoying to manage.
Re:How to not rewrite it in Rust by saghm on Thursday October 24, 2019 @12:07AM (#21341559)
I'm not positive, but I think GP intended to refer to idea that you would need to multiple compilers to compile the project rather than cross-compiling to another platform.
Re:How to not rewrite it in Rust by nullc on Wednesday October 23, 2019 @08:44PM (#21340586)
> (2) You already have other reasons to want to rewrite (design could be improved, code is in a poor state, etc.), and you're deciding between languages.

It would be wise to ignore the language distraction and remember that most urges to rewrite are just flat out wrong. The standard and well respected advice about rewrites doesn't go out the window just because of a fad language, if anything they apply more strongly.

Much of what people perceive as cruft is most of the actual value-- the stored knowledge from years of experience using the software in practice. Few "clean" programs are actually complete.

Re:How to not rewrite it in Rust by RustyRussell on Thursday October 24, 2019 @01:45AM (#21341959)
Andrew Tridgell once said "you never need an excuse to rewrite something".

But I usually append that quote with "but then again, you're not Tridge" :)

Kernighan and Plauger said "don't patch bad code: rewrite it". That is definitely true. And there's a lot of bad code.

Re:How to not rewrite it in Rust by hinkley on Wednesday October 23, 2019 @03:46PM (#21338153)
Or all of the above.

Mature software can have a bunch of hard to fix bugs that you can't motivate anyone to work on any longer. If you want to continue making progress you have to route around the damage somehow.