7 ms·
I have asked this question before, but why write an entirely new frontend, which is an enormous task if you want to reach a similar quality to rustc? rustc_co
by skitter 4y ago
I have asked this question before, but why write an entirely new frontend, which is an enormous task if you want to reach a similar quality to rustc?
rustc_codegen_gcc¹ adds gcc as a backend to rustc alongside llvm, miri and (wip) cranelift. As a result, it always works with the newest version of rust and is already nearly complete after less work.
¹https://github.com/rust-lang/rust/tree/master/compiler/rustc_codegen_gcc https://github.com/rust-lang/rust/tree/master/compiler/rustc...
- whyarewheher 4y agoWhy not do it? There are lots of reasons to have multiple implementations of a language, one of them being gcc is much easier to bootstrap than rustc
- skitter 4y agorustc got bootstrapped already, so download it. If you want to run the compiler itself on a new architecture, cross-compile. If you still decide to bootstrap it again, that's something that will only need to be done once. And even in that case, you can use the second implementation that already exists, mrustc.
- kangalioo 4y agoI've wondered about this for ages and now know: the people who work on GCCRS wouldn't work on rustc_codegen_gcc for one reason or another (familiarity, culture, personal ideals...?). So GCCRS is not "eating away" at available bandwidth and there's no reason not to let GCCRS developers do their thing, even if rustc_codegen_gcc is a more straightforward way of achieving most goals
- IshKebab 4y agoIt's probably not hugely useful from a "I want to compile this Rust code" point of view but I imagine it will at least help iron out ambiguities and bugs in the various specs people are working on. I think there's at least MiniRust and the Ferrocene Language Specification: https://www.youtube.com/watch?v=eFpHadbv34I https://www.youtube.com/watch?v=eFpHadbv34I https://spec.ferrocene.dev/ https://spec.ferrocene.dev/
- rayiner 4y agoBecause single implementation languages are toys. Any real language will have a multiplicity of implementations for different purposes. GCC has a ton of development resources behind it; processor makers are familiar with it and often turn to it to bring up new processors and ISAs, etc. Having a GCC front end is a big step in Rust becoming more popular as a systems language.
- 3836293648 4y agoThis simply isn't true. Only C/C++ people have ever cared about having multiple implementations and have to cling to the catastrophe that those two standards are because of it.
- rayiner 4y agoOh, “only C/C++ people.” I.e. the people who wrote almost all the systems code in the last 40 years. Just those people.
- dataflow 4y ago> Because single implementation languages are toys. Any real language will have a multiplicity of implementations for different purposes. I think that's what the parent was replying to, not somehow claiming C/C++ people are insignificant.
- rob74 4y agoThe catastrophe was that the C/C++ specification left too many things open for interpretation. Regarding "Only C/C++ people": there is at least one more language (Go) that has two implementations (the gc compiler and a gcc backend).
- 3836293648 4y agoI didn't say only C/C++ had several implementations, I said that only the C/C++ communities care about their alternate implementations. The python community looks at pypy like a weird novelty and doesn't use it. The JavaScript community is often actively hostile to SpiderMonkey (firefox) and JavaScriptCore (Safari). As far as I've seen, GccGo is mostly ignored.
- pornel 4y agoFSF wants to support Rust as a first-class language in GCC, which means their own implementation and ability to bootstrap without dependence on other projects. Having two independent implementations is good for finding code depending on compiler bugs. The development will also highlight where the Rust language is not documented/specified enough yet. The GCC implementation may end up with a different design, and perhaps faster compile times, or at least we'll know whether Rust is inherently slow to compile, or is that just rustc. Rustc supporting multiple back-ends can't have as close integration with GCC's back-end as GCC's own front-end.
- simplotek 4y ago> Having two independent implementations is good for finding code depending on compiler bugs. I'd go as far as to claim that having multiple independent implementations is a basic requirement for any programming language which has any aspirations of being production-ready.
- 411111111111111 4y agoThats just silly, there are a lot of production ready languages that only have one full implementation such as Typescript, Elixir etc
- deleted 4y ago[deleted]
- tristan957 4y agoIt would be pretty hard for a second implementation of TypeScript to gain any share of the market since Microsoft refuses to update the TypeScript specification. They point to tsc and say that is the specification. It is completely unprofessional in my opinion.
- simplotek 4y ago> (...) such as Typescript It seems you're oblivious to the fact that projects such as swc[1] exist, and have been adopted by projects such as deno. [1] https://swc.rs/ https://swc.rs/ > Elixir etc I'm not familiar with Elixir nor am I in a googling mood. Nevertheless that was an awfully short list. Why is that?
- ajross 4y agoThe same reasons given[1] for "why write clang when gcc works fine", mostly? Multiple implementations of a language force rigor in the specification[2], find edge cases in implementations, and promote healthy competition in performance. [1] The good reasons, anyway. Please no GPL screaming. [2] Something that IMHO rust has historically been kinda bad at. Even now there remains no clear specification I can find that explains exactly what behavior the borrow checker will admit vs. reject.
- catiopatio 4y ago> The good reasons, anyway. Please no GPL screaming. How is “we want a toolchain we can use as an library from non-GPL code” not a good reason? The ability to link against LLVM and Clang has driven a massive advance in languages and tooling.