Hacker News new | ask | show | jobs
by Manishearth 3613 days ago
The reason I gave in https://news.ycombinator.com/item?id=12148269 applies here too. Clean interop. The ability to freely use a GCd language and smoothly transition to Rust when necessary.

And Rust-as-a-target doesn't necessarily mean you're doing it for the borrow checker. It could also be the typesystem (with the perf and safety of lower level code as a unique bonus). Yes, other, better, typesystems exist, but nobody's saying that Rust is the only language you can do this with :)

1 comments

How is Rust type system helpful? If the codegen produces valid Rust, the Rust type system will not give errors. If it doesn't, I'd say it is a bug of the higher level language - and at best the user is going to see a type error of Rust, while working in X, which is not the best user experience.

Really, these kind of checks belong to the frontend.

No, I mean if you want your higher level language to have a typesystem similar to that of Rust. As I mentioned in the other comment, interop between high level and low level languages usually happens through the medium of C, in which all type information is lost. If your higher level language is compiling to Rust, you can easily add Rusty typesystem features with seamless interop.

I'm not saying Rust's compile errors should ever be shown to the user. I don't think that's what the OP is suggesting either. If rustc errors you should emit an internal compiler error, because your higher level compiler should be producing valid rust code.