3 ms·
It's definitely not idiomatic error handling, but quickcheck uses a mechanism like you speak of: https://github.com/BurntSushi/quickcheck/blob/master/src/tester
by burntsushi 12y ago
It's definitely not idiomatic error handling, but quickcheck uses a mechanism like you speak of: https://github.com/BurntSushi/quickcheck/blob/master/src/tester.rs#L403-L413 https://github.com/BurntSushi/quickcheck/blob/master/src/tes... (This is just implementation details---I'm not saying this is actor based!)
This lets it handle failures that panic, and then shrink the witnesses to find (hopefully) minimal witnesses. :-)
- rdtsc 12y agoInteresting, thanks for the link! I'll have to look at that some more. This calls for a Rust actor library perhaps. Memory and type safety in Rust seems like might work well there (making sure memory is not accidentally shared between concurrency units -- really one of the main advantage of Erlang's VM).
- charlieflowers 12y agoWhy do you need a separate thread here? Is Rust's panic tied to the currently executing thread?
- burntsushi 11y agoKinda sorta. My knowledge is limited on the topic, but AFAIK, unwinding for Rust is designed to have at most one try/catch block per thread. That said, there is a `catch_panic` function (http://doc.rust-lang.org/std/thread/fn.catch_panic.html http://doc.rust-lang.org/std/thread/fn.catch_panic.html), but it's unstable. So in stable Rust, the only way to catch a panic is to spawn a new thread, I think.