On 2012-03-19, at 18:28 , Graydon Hoare wrote: > > The longer answer is that we're familiar with the CL condition system as well > as a number of alternatives, and need to spend some time exploring to find > what "fits" the Rust semantics best. I spent quite a while sketching, > prototyping and researching this aspect of the language before getting > started, and wound up adopting a "wait and see" approach, letting other > language features mature first. It's a complicated topic and there's a lot to > say. To summarize where my thinking on it is _now_, it's something like so: > > - The CL system is overengineered (separated handle vs. restart)
What about Smalltalk? It also has conditions (in that the stack is *not* unwound before the handler is executed and execution can be resumed) but does not have all the formal complexity of CL's restarts. Instead, the error handler can just send `resume` or `resume:` to the error object, and execution will resume from the point having thrown the error, returning the value if any is provided[0]. Smalltalk provides/d a few other neat handling strategies (most being linked to Smalltalk's error handling being bound to a block): * `retry` would re-execute the block * `return` & `return:` would just return (from the block) * `retryUsing:` would replace the original block with the one provided and then execute *that* (with the error handler rebound there) * `pass` would just let the exception bubble up * `outer` would behave like `pass` but "wrap" the exception: in case of `resume` (in an outer handler) execution would resume from this handler instead of the original creator of the exception [0] there's a small caveat in that the exception needs to be resumable — answer `true` to the message `isResumable` _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
