Live data from Hacker News

Rust front-end merged in GCC trunk

gcc.gnu.org

111–120 of 135 posts

Re: Rust front-end merged in GCC trunk

#111
post #59

Earlier quoted context omitted.

FSF 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 perha…

> 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.

That's an antiquated notion from the times when programming language implementations were 99% propriety, so you needed some ability to "shop around".

Any time you hit a fork button on an Open Source programming language's github page, you get your own independent implementation. Hire a contractor and introduce any "extensions" you need.

Re: Rust front-end merged in GCC trunk

#112
post #77

Earlier quoted context omitted.

> Because single implementation languages are toys ‶Toys″ like Go, OCaml, arguably Ruby & PHP, Perl, Erlang, Kotlin, ...

Go has a GCC implementation (which I use). PHP has alternative VMs and specialized servers for serving it fast and in encrypted manner (they are closed sourced), tho. Kotlin runs on JVM, which has at least three fully compliant implementations. Erlang is a specialized language and telecommunications platform. It’s something different.

Also artichoke ruby https://www.artichokeruby.org/

Re: Rust front-end merged in GCC trunk

#113

Earlier quoted context omitted.

That's rather rustc_codegen_gcc. gcc-rs is more for people who don't like LLVM and/or Rust. https://github.com/rust-lang/rustc_codegen_gcc

A rust implementation for people who don’t like rust seems like a strange take.

Not too strange. Imagine the reverse: a C compiler written in Rust. There is an awful lot of software in C that I want to use, but I really dislike C itself. If I found some deficiency in C compilers and felt the need to write my own, I certainly would prefer to write it in Rust.

It would be a C implementation for people who don't like C.

Re: Rust front-end merged in GCC trunk

#114
post #107

Earlier quoted context omitted.

> 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.

These days lots of languages are single-team efforts, because producing high-quality production programming languages is an incredibly large amount of (difficult) work. It is really, really difficult, it takes many years, you constantly get shit on by people for everything, and if you're lucky you might get a tiny bit of money after a while. It isn't just coincidental complexity; programmers are actually incredibly d…

The number of people who use those alternative implementations -- or even the quality of their output with respect to performance or platform support -- don't really matter: the reason to insist on (at least, and as unrelated as possible) two separate implementations of something is to ensure that the behavior of the language isn't merely an accident of incorrect code in the compiler instead of an intentional choice by the language designers, as it shows that two different teams came to the same result (at which point hopefully it is noticed if there are spec issues and those are either corrected in the parent compiler or "bug for bug" duplicated in the child compiler after documenting the issue in the spec). Until you have done this, it is difficult to even claim what the language even is.

Re: Rust front-end merged in GCC trunk

#115
post #88
post #37

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...

The 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 e…

> 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.

Re: Rust front-end merged in GCC trunk

#117
post #109

Earlier quoted context omitted.

> since it enables a lot of cool tooling What leads you to believe that the lack of alternatives leads to enabling "a lot of cool tooling"? > and great new features are introduced quickly in the official implementation. That has zero to do with existing only a single implementation, and everything to do with having developers working on unstable releases and a poor job thinking things though by writing stuff down bot…

> What leads you to believe that the lack of alternatives leads to enabling "a lot of cool tooling"? Rust projects have settled on Cargo, which gives them uniform way of building, testing, getting dependencies, docs generation ( https://docs.rs ), IDE support, etc. ( https://lib.rs/development-tools/cargo-plugins ) Contrast this with C which has several compilers and plenty of build systems to choose from, often more…

Cargo is not universal. Many projects use rustc directly with an alternative build system such as bazel, make, or meson as they are in multilingual repos. The fact these projects exist doesn't affect your experience with rust. The fact a gcc tool chain for rust will exist should similarly not affect your experience.

Re: Rust front-end merged in GCC trunk

#118
post #83

Earlier quoted context omitted.

This 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.

Somehow Python people, Java people, Ruby people, JavaScript people managed to produce multiple independent high-quality implementations.

python has 1.5 implementations pypy is close, but not that close to being a complete implementation.

Re: Rust front-end merged in GCC trunk

#119

Earlier quoted context omitted.

Thats just silly, there are a lot of production ready languages that only have one full implementation such as Typescript, Elixir etc

> (...) 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/ > 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?

No post body was provided.

Re: Rust front-end merged in GCC trunk

#120
post #101

Earlier quoted context omitted.

> 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.

Counterexample: the fact that there is only a single official go compiler is great advantage IMO since it enables a lot of cool tooling and great new features are introduced quickly in the official implementation.

gccgo was released in 2012.

https://go.dev/doc/install/gccgo

https://www.gnu.org/software/gcc/releases.html

Post reply on HN