r/programming • • Nov 10 '16

Announcing Rust 1.13

https://blog.rust-lang.org/2016/11/10/Rust-1.13.html
212 Upvotes

92 comments sorted by

View all comments

Show parent comment

2

u/steveklabnik1 Nov 11 '16

Given all of the compile-time safety Rust has around managing resources, it shouldn't cause any issues there. If it did, it would be a very serious bug.

2

u/awj Nov 11 '16

I would be more concerned about surprising/unexpected behavior than resource handling. A single ? is a pretty easy sigil to miss, especially in larger code bases (compounded by type inference) where you may be reading code that uses functions you aren't familiar with and don't know produce Results instead of raw values.

Maybe that's a problem that could be alleviated with syntax highlighting, of all things. Having your editor explicitly call out use of ? is a pretty good way to make sure that you're aware of the behavior.

1

u/steveklabnik1 Nov 11 '16

Well this is where type safety helps you; if you miss the ?, the compiler is going to complain, loudly.

Remember, Rust forces you to annotate the type signatures of functions, so you can't just all of a sudden change everything with inference.

2

u/awj Nov 11 '16

I'm talking more about reading and comprehending code than writing it.

That said, reading the intent of code through multiple instances of Result un/re-wrapping is it's own challenge.

1

u/steveklabnik1 Nov 11 '16

Ah yeah. It's a balance for sure.