Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> It being a non-GCed language with ADTs is a big one

C++ has both, too, so in this case Rust's only advantage would be memory safety.



Having used both (and in the space for writing JITs particularly), C++'s support is very weak in the space of ADTs. Like most things in C++ you _can_ reach it with straight jacketing yourself in a particular way, with 80/20 static analysis rules backing that and 20% manual code review, but it's difficult to maintain.

Rust gives you that more or less by default and for free wrt tooling. It's sort of the classic "Rust makes you write the C++ you should have been writing all along", which makes it a net win IMO.


It might be weak, but I think every browser engine makes do with what they have available fairly well…


Given the fact that Mozilla is the primary sponsor of Rust, and Rust has been sneaking its way into Chrome as well, I'd say the authors of those browsers disagree with you.


I'm not them, but I suspect that they're slowly switching not because of its slightly better abstract data types but because it offers better memory safety.


Those are one and the same. The ADTs are how the shape and validity of the data is described to the compiler in a lot of cases. Rust wouldn't be able to be memory safe without it.

C++'s ADTs are easy to subvert even accidently; Rust's can't be without explicitly calling it out as unsafe.

It allows you to describe transformations of state in a formal set theoretical way. You should check out formally verified software like CompCERT and sel4 and their heavy use ADTs internally to achieve that. Rust obvs isn't full formally verified but it's a neat 80/20 in that direction.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: