4 ms·
You can write equivalent programs in C++, but if you learned Rust well I am not sure you'd want to. The parallelism shown is still fairly coarse grained and am
by smosher 14y ago
You can write equivalent programs in C++, but if you learned Rust well I am not sure you'd want to.
The parallelism shown is still fairly coarse grained and amenable to traditional techniques. [...] If the redesign was using C/C++, they'd likely get the same benefits, just with uglier code.
I should hope so, Rust's parallelism is nothing new after all! (Okay, I know, you probably mean by writing programs using explicit mutexes and all that.) I really want to talk about the second part of the quote: what exactly are those benefits? I think you've excluded safety for some reason.
If Servo offers competitive performance I think it's most likely the whole engine will simply replace Gecko. I mean why would you spend the time and money to go from the safer to the less-safe code when you can use what you've got?
- cromwellian 14y agoThere's obviously benefits in using better languages for safety and error checking, it's one of the reasons why I like Closure Annotations/GWT/Dart over raw Javascript because of my experience on large projects and relatively simplistic bugs silently propagating through. The traditional response to these kind of language imperfections is "better tests, better practices". Otherwise as, Unit Tests solve all problems. For C++, someone would say to use some set of abstractions or static analysis tools that confers additional safety that isn't available in the out-of-the-box language. Language level support tends to encourage more consistent usage of something than just depending on vigilance. My metapoint though, is that large code bases are hard to displace, especially if the enduser benefits can be achieved through iteration. Rewriting Gecko from scratch in Rust is a tall order, considering how long it took Gecko and WebKit to get to where they are now. It seems much more likely that WebKit/Gecko can be refactored to get most of the benefits in a much shorter period of time than a rewrite.
- smosher 14y agoI don't find testing as a solution very convincing, it's just the same problem all over again: more code which may ran yet fail to live up to expectations. It's a tool, but static checks are better for things that can be statically checked. But I think you hinted at being in line with that, and yes you should still write tests. But it's not right to think of Rust as a safe C++ in the small, particularly because of the ban on shared mutable state. IIRC, Rust is partly a product of the difficulty C++ had in this area. I don't think they're rewriting Gecko. If the transitive property holds, the code in Servo is at least as different from the code in Gecko as Rust is from C++, and I think that's only amplified in the design. Servo aims to do things that are not realistic for Gecko, like parallelizing more of its operations. I don't think they'd be going this far with Servo at this point if it wasn't for that, I think Gecko would just see the necessary changes and that would be it. Either way, Servo exists. We're told it started as research, but it is obviously at the point where its promise is more concrete. When the lessons have been learned from Servo, it will be a complete, embeddable (this is one goal Gecko gave up on) engine. There's no sense in backporting its innards to the C++ engine when you can just drop it in place.
- pcwalton 14y ago"The traditional response to these kind of language imperfections is "better tests, better practices". Otherwise as, Unit Tests solve all problems." The security vulnerabilities found in all browser engines stemming from things like use-after-free suggest otherwise. "For C++, someone would say to use some set of abstractions or static analysis tools that confers additional safety that isn't available in the out-of-the-box language." It's really, really hard. The language works against you at all levels. Type systems are much easier ways to achieve the same result.
- abraininavat 14y agoI'd like to see a unit test that detects (consistently) data races. And static analysis of complex parallel programs is just too hard.