On 5/30/12 3:41 AM, Graydon Hoare wrote: > Hi! > > Sorry I've been away, I wanted to talk about this issue, or, well, kinda > just remind you and others in this conversation that there is (in my > mind at least, and in the bug tracker[1]) "a plan" for how to do this. > I've been continuing to assume this is something we'd handle with > per-task dynamic-scoped values, just haven't got around to implementing > them yet. Should be almost entirely library code.
Ah, great! My main concern is that we would end up with a Rust used in-the-wild without either guidelines, library or mechanism for handling non-fatal issues. > Here's a sketch of your 'move' function written in this style: > > https://gist.github.com/1f9c8fe1debd9a504eef Let me rephrase your code to be sure that I understand it correctly. I will keep using "issue" for the moment instead of error/exception/failure/... to avoid projecting too much semantics. * Function `handler::try` prepares for execution a block (let's call it the "action block") and lets the developer registers closures to handle various issue cases that may arise during the execution of that action block. * Function `?.handle(some_issue)` registers a block to handle one specific kind of issue. * Execution of the handler block takes place locally, without any stack unwinding. * Execution of the action block starts at the end of the chain of `?.handle(...)`. Is there a way to do this in Rust or does this require the addition of some kind of terminator? * A call to `signal` gives a chance to other issue handlers to execute. Do I understand correctly that this actually somehow pops the issue handler to avoid cycles? * I also have the impression that a call to `signal` also performs some form of non-local return. Am I right? By the way, if I understand correctly, I believe that type name `handler<...>` is a little counter-intuitive. > > I think a sufficiently gnarly implementation that's allowed to hang a > special-variable list off the side of each task should be able to work > given that, just keying off the different addresses of the various > consts in memory. A bit of a hack but I think it might work. > > Note as discussed earlier, in that example the handling all happens _at_ > the dynamic site of signalling (via a call to a passed-down closure, > accessed through the handler library) not by unwinding. Unwinding still > only happens on failure and is still idempotent, unrecoverable. > > Does this not sit well with you currently? I will reply once I am sure that I understand the example :) Cheers, David -- David Rajchenbach-Teller, PhD Performance Team, Mozilla
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
