News for hackers. Stuff that matters.
Re:Speedy Web Compiler – A Rust port of Babel and Closure Co... by steveklabnik on Sunday December 23, 2018 @11:03AM (#18746772)
Rust can not guarantee correctness, but it is a focus in some sense. Strong static typing, robust error handling... you can encode a lot of invariants in the type system. Especially compared to something dynamically typed, like JavaScript. It’s not a proof assistant, but every bit helps!
Re:Speedy Web Compiler – A Rust port of Babel and Closure Co... by nkcmr on Sunday December 23, 2018 @11:11AM (#18746828)
Thanks for correcting me there. Rust _does_ have a more than the borrow checker that are helping the programmer avoid common dynamic language issues (and rust is awesome).

I just know that even if the compiler of the language I am writing is very smart and can catch a lot of my silly mistakes, it would behoove me to think that I could write "bug free" code as a result. I would still write my code defensively, even in rust.

Re:Speedy Web Compiler – A Rust port of Babel and Closure Co... by steveklabnik on Sunday December 23, 2018 @11:16AM (#18746856)
Absolutely. I’ve written many bugs in Rust. But on the whole, my first attempts have less bugs overall. YMMV, of course.
Re:Speedy Web Compiler – A Rust port of Babel and Closure Co... by leshow on Sunday December 23, 2018 @03:50PM (#18748233)
Should be noted it usually takes a bit longer to get to that first working version in Rust. It's debatable whether in the long run it's faster to develop with.

I would argue it is much faster to get to a final, 'correct' working version because you spend less time debugging. Time is also drastically cut down the more familiar you are with the language, but still, I'd love to see some data on dev time between languages with robust type systems vs dynamic.

Re:Speedy Web Compiler – A Rust port of Babel and Closure Co... by KMag on Sunday December 23, 2018 @08:25PM (#18749629)
Do you mean fewer bugs, or less severe bugs (or some other non-count metric other than severity)?
Re:Speedy Web Compiler – A Rust port of Babel and Closure Co... by chrismorgan on Monday December 24, 2018 @12:17AM (#18750504)
I expect my experience is much the same as Steve’s on this point.

Mostly I would say fewer bugs; the bugs that are avoided vary in severity. Many, probably most, are the severe but obvious bugs where you would have hit the first time you tried running the code in another language, but which are instead now caught by the compiler—that’s why “time to first run” is not a reasonable metric for comparing writing code in such languages, but “time to first meaningfully successful run”! But it’s also common for Rust to catch and prevent far more insidious bugs; especially, in my experience, in two areas: firstly, with respect to ownership—things like passing data structures around and improperly mutating them where you should have cloned it instead, which is structurally impossible in Rust (disregarding things like Rc<RwLock<T>>, which make it possible, but make the intent very much clearer); and secondly, where enums (tagged unions) can be used, due to the greater and more precise expressivity.

I have much greater confidence that my first pass at a piece of code will work correctly in Rust, once it compiles, than I do in JavaScript—and I’ve been working in JavaScript a lot more than Rust in the last couple of years, yet it’s still true.

Re:Speedy Web Compiler – A Rust port of Babel and Closure Co... by steveklabnik on Monday December 24, 2018 @09:45AM (#18752324)
Yes, this is exactly what I mean.