Sealed exceptions (was Re: ES4 draft: Error classes)

Kevin Reid <[email protected]>
Newsgroups gmane.comp.lang.e.general
Message-ID <[email protected]>
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/>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.