Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

rust just got 4x more productive [shill thread]

Name: Anonymous 2016-12-16 15:09

Rust designers developed an idiom for concisely propagating errors outwards with a macro called try!:
let file = try!(File::open("file.txt"));
More recently, Rust shipped an even more concise notation for error propagation, the postfix ? operator:
let file = File::open("file.txt")?;

Name: Anonymous 2017-01-05 0:25

>>33
That was Hoare, not Gosling.

And as Hoare said about it:

I call it my billion-dollar mistake. It was the invention of the null reference in 1965. At that time, I was designing the first comprehensive type system for references in an object oriented language (ALGOL W). My goal was to ensure that all use of references should be absolutely safe, with checking performed automatically by the compiler. But I couldn't resist the temptation to put in a null reference, simply because it was so easy to implement. But I couldn't resist the temptation to put in a null reference, simply because it was so easy to implement.

Even if Hoare had done the Right Thing in ALGOL W, it's pretty obvious that null references are such a convenient feature that someone else would've invented them for the same reasons. And then we'd be exactly where we are today: with all the most popular industry languages having very weak and unsafe type systems, because it's easier to bash out code that way.

Maybe programmers just can't be bothered with safety.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List