[e-lang] Sealed exceptions (was Re: ES4 draft: Error classes)

Kevin Reid kpreid at mac.com
Tue Mar 18 08:22:39 EDT 2008


On Mar 17, 2008, at 14:16, Mark Miller wrote:

> Do we have anything written up on sealed exceptions for E? Might it  
> be relevant?

All I can think of is my original description,

   http://www.eros-os.org/pipermail/e-lang/2006-February/011112.html

Note that I'm not sure about the eventual-failure approach I mention:  
it now seems to me that Just Plain Broken References are a better  
idea, augmented with ejectors for getting there:

   to foo(x, y) {
     escape e {
       return f(y, bigComplexOperationBlaBla(x, e))
     } catch p {
       return Ref.broken(p)
     }
   }


A further thought: suppose we have a protocol
   to bar(a, b, ejector)
that we wish to use eventually, from another vat. It seems that a  
necessary utility would be something which performs the above ejector- 
to-broken without having it hardcoded into the target's protocol.

   sendWithEjector("bar", a, b)

==>

   def verb := "bar"
   def args := [a, b]
   target <- __whenMoreResolved(def _ implements pbc {
     to __optUncall() { ... }
     to run(target) {
       return escape e {
         E.call(target, verb, args + [e])
       } catch p { Ref.broken(p) }
     }
   })

Additional refinements to this would be inserting the ejector in  
other positions (e.g. see the lambda-args protocol), and an optional  
wrapper for the exception, Ref.broken(wrap(p)), which distinguishes  
this particular ejection from other broken references the callee may  
return.

-- 
Kevin Reid                            <http://homepage.mac.com/kpreid/>




More information about the e-lang mailing list