News for hackers. Stuff that matters.
Re:Announcing Rust 1.14 by cgag on Thursday December 22, 2016 @03:17PM (#13240019)
I wish it were u and e rather than unwrap/expect. Or just "yolo" or "!" or something.

Is there a way to rename / alias methods like that?

edit: I see ? is going to be a trait you can implement to do that, so that'll be nice (probably).

Re:Announcing Rust 1.14 by killercup on Thursday December 22, 2016 @03:23PM (#13240078)
There's a crate for that™: https://crates.io/crates/yolo
Re:Announcing Rust 1.14 by openasocket on Thursday December 22, 2016 @03:21PM (#13240048)
There is: make a trait called SimplerUnwrap<T> or something with the method u(self) -> T. Implement it for Option<T> and you are good to go!
Re:Announcing Rust 1.14 by lisivka on Thursday December 22, 2016 @03:58PM (#13240337)
Why not use C instead? I see no benefit to use complicated language which cares about errors and then completely ignore that care.
Re:Announcing Rust 1.14 by openasocket on Thursday December 22, 2016 @05:06PM (#13240796)
You're not ignoring errors with unwrap(): if there is an error, the program will print out a stack trace and exit. If you have some operation that could potentially fail but you know it won't (like if you are sure that node has a parent) what do you do? If the operation actually does return an error, it means what you thought to be true was wrong, and in some cases that means something has gone seriously wrong, and your program should immediately stop so you can debug it. You can try to handle the error yourself, using try! or the ? operator, but unless you plan to be able to recover from that error, or you want to output a more end-user-friendly error message than a stack trace, what's the point?
Re:Announcing Rust 1.14 by Rusky on Thursday December 22, 2016 @04:19PM (#13240480)
Because while you may not care at first, you will later, and Rust will help you out then.