Live data from Hacker News

Shipping Rust code in Firefox

hacks.mozilla.org

91–100 of 197 posts

Re: Shipping Rust code in Firefox

#91

Earlier quoted context omitted.

> I wonder if Firefox will slowly become written in mostly Rust. I doubt that will ever happen. Small parts of Firefox, yes, but the browser is enormous. I think I once read that even Servo, which is a showcase for Rust, has more C/C++ code in it than Rust code, largely because it uses Firefox's JS engine.

> I think I once read that even Servo, which is a showcase for Rust, has more C/C++ code in it than Rust code Not in the core project: https://github.com/servo/servo

Where is the feature in GitHub that would show the languages used in a repository? That would be useful here regarding this comment.

(Note I have no doubt you are right. It would just be a useful metric.)

Re: Shipping Rust code in Firefox

#94
Not in the same league as the mp4 parser shipping to all Firefox users, but GeckoDriver [1], a Mozilla-authored standalone binary for interacting with Firefox via the WebDriver protocol (e.g. using Selenium) is also written in Rust and shipping, possibly to as many as hundreds of users ;)

Overall the experience of using Rust for that project has been pretty great; the original requirements for a language were "able to produce static executables with no external runtime requirement, not prone to C-style memory safety issues, and accessible to a team with mostly Python backgrounds". That leaves quite a few options — Go for example — but being a Mozilla project taking the opportunity to use Rust seemed like it would align better with initiatives like those discussed in the article.

Apart from the general niceness of Rust-the-langauge, the experience of the Rust ecosystem has been really nice. Not only were there easy-to-install, well documented, packages to do much of the heavy lifting (http server, command line argument handling, etc.), it was also quite straightforward to set up travis builds using cargo to compile releases for linux64+musl osx and cross-compile releases for linux-arm7hf (added because someone asked about running on raspberry pi and it turned out to be trivial) and win64. The only wrinkle so far has been the difficulty of cross compiling to win32, meaning we might actually need to set up Appveyor or similar.

Obviously this is a much smaller project than the original post in terms of the number of users, and rather different as it is much higher level and could comfortably be written in Python or similar, except for the distribution requirements. However I think the use of Rust has been an unmitigated success, and I would be tempted to use it for a lot more projects that I would never consider writing in C/C++.

[1] https://github.com/mozilla/geckodriver

Re: Shipping Rust code in Firefox

#95

Earlier quoted context omitted.

The compiler has been fantastic emitting warnings about future language changes and I have appreciated it. The Rust compiler's messages (in general) are some of the highest quality I've seen, actually. The Rust Devs have done a superb job at documenting the changes. I'm more complaining that breaking changes to a non-beta language leave a bad taste in my mouth. Sure, they do have to happen sometimes, but it seems tha…

I'm curious, do you have a language in mind that has been better than Rust as far as breaking changes go after the 1.0 stable release? An example? Rust has been far above most languages/libraries that I've found in dealing with breaking changes. The complaint here seems pretty empty to me. (Complaining for the sake of complaining)

I think that Java has (on the whole) been very stable, but as steveklabnik pointed it, it also has had breaking changes. But considering Java's age and the quantity of these changes, I'd say it's been exceptionally good (especially since there's some fairly hefty pre 1.5 stuff that will still compile and run.) Clojure, Go, JavaScript, and Scheme come to mind.

I don't think it's fair to compare a language's breaking changes to a library's. I expect different levels of stability depending on the library, but with languages I expect the same level of stability. Rust __has__ been very good at dealing with breaking changes, yes. I'm stating that I don't like breaking changes in a language. Breaking changes in a 1.0 > language are something that should be exceedingly rare.

Re: Shipping Rust code in Firefox

#96

Earlier quoted context omitted.

> I think I once read that even Servo, which is a showcase for Rust, has more C/C++ code in it than Rust code Not in the core project: https://github.com/servo/servo

Where is the feature in GitHub that would show the languages used in a repository? That would be useful here regarding this comment. (Note I have no doubt you are right. It would just be a useful metric.)

Did they just..get rid of it? I can't find it either.

Re: Shipping Rust code in Firefox

#97

Earlier quoted context omitted.

I'm curious, do you have a language in mind that has been better than Rust as far as breaking changes go after the 1.0 stable release? An example? Rust has been far above most languages/libraries that I've found in dealing with breaking changes. The complaint here seems pretty empty to me. (Complaining for the sake of complaining)

Go has better backward compatibility.(i.e. no breaking change after 1.0)

This is not true:

  > Although we expect that the vast majority of programs will
  > maintain this compatibility over time, it is impossible to
  > guarantee that no future change will break any program.
https://golang.org/doc/go1compat

It's extremely similar to our attitude, and that of Java, etc:

  > Of course, for all of these possibilities, should they arise,
  > we would endeavor whenever feasible to update the specification,
  > compilers, or libraries without affecting existing code.
And they have in fact made such a change: https://golang.org/doc/go1.4#methodonpointertopointer

This isn't a bad thing! My point is as I said below: every language includes some small breaking changes, even if the goal is to have very, very few of them.

Re: Shipping Rust code in Firefox

#98

Earlier quoted context omitted.

How about starting with WebAssembly... should have less scope.

The people who would work on these two things are pretty disjoint, or at least, I'm not aware of any SpiderMonkey people working on our wasm support. So it's not really an either-or kind of proposition.

I wonder if you could ship a fully featured javascript engine written in WebAssembly. Then servo could just include that and it would interpret/JIT the rest of the JS.

Re: Shipping Rust code in Firefox

#99

Earlier quoted context omitted.

> I think I once read that even Servo, which is a showcase for Rust, has more C/C++ code in it than Rust code Not in the core project: https://github.com/servo/servo

Where is the feature in GitHub that would show the languages used in a repository? That would be useful here regarding this comment. (Note I have no doubt you are right. It would just be a useful metric.)

Do they still have the colored lines towards the top? I think you have to click on it to see the language percentage breakdown.

Re: Shipping Rust code in Firefox

#100

Earlier quoted context omitted.

Where is the feature in GitHub that would show the languages used in a repository? That would be useful here regarding this comment. (Note I have no doubt you are right. It would just be a useful metric.)

Did they just..get rid of it? I can't find it either.

No, it works for other repostiories.

Probably Github uses cloc. I downloaded the code (over 500MB, insane!) and cloc throws an error.

Post reply on HN