News for hackers. Stuff that matters.
Re:Fish (shell) porting to Rust from C++ by bpye on Monday January 30, 2023 @08:59PM (#34589888)
C++ is definitely very sticky. I’m not yet convinced that Rust will successfully displace it in projects like LLVM or WebKit. Components perhaps, but I think we’re quite a way from these sort of major projects being written in Rust, though I’d be happy to be proven wrong.
Re:Fish (shell) porting to Rust from C++ by mustache_kimono on Monday January 30, 2023 @10:18PM (#34590434)
> I’m not yet convinced that Rust will successfully displace it in projects like LLVM or WebKit.

This comment induces a sort of cognitive dissonance in me. Rust is in the Linux kernel, and Firefox. How are LLVM and WebKit different? Of course, Rust may not displace C++ everywhere. Is that what you were saying?

Re:Fish (shell) porting to Rust from C++ by bpye on Monday January 30, 2023 @10:42PM (#34590624)
That's sort of what I was getting at. It seems incremental adoption is likely, but I'm not sure anyone is seriously going to try and rewrite all of Firefox or Linux in Rust.
Re:Fish (shell) porting to Rust from C++ by fbdab103 on Tuesday January 31, 2023 @12:23AM (#34591510)
Those are some of the largest public projects in existence. Even if you went with a "traditional" alternative (D? Swift? Ada?) - there is no way such an effort would not take years. Incremental is the only way to transition such behemoths.
Re:Fish (shell) porting to Rust from C++ by pitaj on Monday January 30, 2023 @11:31PM (#34591147)
Not to mention that Chrome developers are working on bringing in Rust: https://security.googleblog.com/2023/01/supporting-use-of-ru...

If anything, I'd think a browser is prime real estate for Rust, where the security guarantees are just that much more important.

Re:Fish (shell) porting to Rust from C++ by throwaway894345 on Tuesday January 31, 2023 @01:00AM (#34591765)
Browser dev was precisely Rust’s motivating use case.
Re:Fish (shell) porting to Rust from C++ by mkipper on Tuesday January 31, 2023 @02:36AM (#34592388)
Those examples aren’t super convincing to me. At least not yet.

Rust was created at Mozilla to help with browser engine development, so it’s not totally shocking that it’s in Firefox.

Rust is in the Linux kernel in the sense that its build system can compile interoperable Rust code. But the kernel is big — it’s 30 years of C code written by thousands of contributors which receives dozens of patches (in C) per day. Obviously “Rust in the kernel” has to start somewhere, but as of today, it’s really only relevant to Rust people who evangelize it. A kernel developer who doesn’t read HN would probably have no idea that Rust support was added.

Going back to the OP, the claim that C++ is “becoming a legacy language” is…bold. IMO it’s a ridiculous comment until large C/C++ projects (e.g. Linux, LLVM, Postgres/SQLite, big AI/ML toolkits) are mostly rewritten in Rust or overtaken in market share by alternatives written in Rust. If all of the biggest systems software projects in the world are still mostly written in C/C++ and still receive almost all of their contributions in C/C++, claiming that Rust is bumping those languages to some “legacy” tier is ridiculous. Things might go that way in the future, but we definitely aren’t there yet.

Re:Fish (shell) porting to Rust from C++ by mustache_kimono on Tuesday January 31, 2023 @09:01AM (#34595065)
> IMO it’s a ridiculous comment until large C/C++ projects (e.g. Linux, LLVM, Postgres/SQLite, big AI/ML toolkits) are mostly rewritten in Rust or overtaken in market share by alternatives written in Rust.

Given this super high bar, I'm not sure any language would fit the mold of "legacy". I could just as easily say COBOL isn't legacy given this standard, as the world has not chosen to rewrite most of its COBOL software in Java yet, although we tend to think of COBOL as the legacy language.

So I disagree with your definition of "legacy". "Not considered for greenfield development" seems like a better definition of legacy to me.

So, yes, the term "legacy" for C/C++ would seem a little heavy handed for all software domains. But, for the software domain `fish` is targeting, it's not a ridiculous claim. Lots of the new, interesting stuff happening in systems-y, tools-y CLI stuff is happening in Rust. That isn't to say all of it is, or C/C++ isn't used ever, but if the OP said, "Look at the trajectory", and "Can you imagine writing a new shell in C or C++ in 10 years?", I might have to agree. Or, more concretely, if the OP said, "I personally can't imagine writing my open source software CLI tool in C or C++ in 10 years", I would definitely agree.

Re:Fish (shell) porting to Rust from C++ by pornel on Monday January 30, 2023 @10:35PM (#34590550)
These two projects are older than Rust itself, and have hundreds of person-years of effort put in them. That's a huge investment, and huge inertia. It will take a similarly long time and large investment to replace them. It might happen eventually. Blink is adding support for Rust dependencies. Rustlang is adding pure-Rust cranelift back-end.

But also look into the future: if someone is currently writing very first lines of a project that will become equally big in a decade or two, that may likely be in Rust, not C++.