News for hackers. Stuff that matters.
Re:Zero-cost futures in Rust by skybrian on Thursday August 11, 2016 @12:04PM (#12269350)
Is there any special handling for Futures that complete with an error?

Also, how do you debug code that's hung or taking too long? It might be useful to get a list of all the jobs (incomplete Futures) that are currently running, much like running 'ps'.

Re:Zero-cost futures in Rust by aturon on Thursday August 11, 2016 @12:12PM (#12269419)
Yes -- the blog post didn't go into details about this, but Futures in general have an error type as well, and all the combinators know how to propagate errors correctly. (There's also a notion of "cancellation" for a future -- we'll get into this with later posts).

In terms of debugging, there's not infrastructure currently, but the kind of thing you're talking about should be easy to add!

Re:Zero-cost futures in Rust by KirinDave on Thursday August 11, 2016 @02:29PM (#12270574)
I've used async tooling extensively on several platforms now, including Go, C#, Java, Clojure's core async, the new async methods in JS.

The challenge of these state machine codegen abstractions is not performance. It's making source-facing debuggers do the right thing and handle errors in a way that doesn't break the illusion that the code running is the code in source.

If you can match the degree of support C# has for error handling, you'll be in an amazing place.

Re:Zero-cost futures in Rust by skybrian on Thursday August 11, 2016 @04:11PM (#12271251)
It would be useful to give a Future a name (for debugging) in the code that creates it, so a list of "pending jobs" is more readable. I don't think any other language is doing that.

Like other kinds of debugging info, you might also want a way to strip out the job names in a production build.

Re:Zero-cost futures in Rust by Rusky on Thursday August 11, 2016 @12:09PM (#12269400)
Because Rust doesn't do exceptions the way other languages with futures do, there's no special handling. Just use a future representing a Result, like you would for synchronous errors.