[m-dev.] for review: add extras/exceptions

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Jul 23 16:20:24 AEST 1998


On 23-Jul-1998, Peter Schachte <pets at students.cs.mu.oz.au> wrote:
> > Another alternative would be to provide some way for C code to
> > catch Mercury exceptions, by exporting a version of `try_io' to C.
> 
> How about using the function trail?  This way the overhead is only paid by
> code that has resources it needs to protect (once the overhead of having a
> trail is paid).

That works.

The issue really is that existing C code isn't longjmp-safe
and modifying it to ensure that no resources are leaked if
the code gets longjmp'ed over is not at all trivial.

> > (Fixing the limitation would require adding new builtin types
> > `impure pred', `impure pred(T)', which is clearly a language extension...)
> > 
> > But it's not related to exception handling as such, so it should be a
> > separate change.  I'm hoping that Peter Schachte will do this one ;-)
> 
> I'd love to, if I get the time.  Maybe while we're complicating the pred
> types would be a good time to add the concept of a one-shot closure:  a pred
> that will be executed precisely once.

I just meant I was hoping that you would fix the documentation
to say that we currently don't support it, as Tyson suggested.
Of course it would be nice if you add the feature, but that is
a bit more work ;-)

> Such things could sensibly have
> curried output arguments.  Is that on the wish list, BTW? 

Yes, I think it is.
Supporting one-shot closures is a fair bit more work than supporting
impure closures, IMHO.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list