[m-dev.] cc_multi or det ?

Holger Krug hkrug at rationalizer.com
Tue Aug 7 02:53:32 AEST 2001


On Mon, Aug 06, 2001 at 09:31:57AM -0700, Ralph Becket wrote:
> > As a Java programmer I started to like exception, because they clearly
> > separate expected and unusual behavior. As Mercury programmer I have
> > to use them very cautious, because catching them is 'cc_multi'. So one
> > further question:
> 
> That's interesting.  I conducted an informal poll among my friends
> and colleagues (who span the space from academics to commercial
> programmers, functional advocates to die-hard imperative types) about
> exception usage and they almost exclusively said they felt exceptions
> were to be avoided wherever possible.  The concensus was that handling
> exceptions was as hard as handling error codes, but with a wider scope
> for introducing bugs.
> 
> It sounds like your experience has been different: could you elaborate?
> People's good experiences with such things often indicates good points
> in the design space.

When working with exception I can concentrate on what matters, throw
an exception when something is wrong and, in the first step, forget
about it.

After having finished the main application core, I can add nice
exception handlers to make all fine and clean.

What's important: I can concentrate on the main issues. I very related
with DCG code in Mercury. You really don't wan't to tackle with IO0
IO1 IO2 IO3 IO4 IO5 IO6 IO7 IO8 IO9 IO10 IO11 IO12 IO13 IO14.  So I do
not want do have strange errors in my clean and nice return types.

Admittedly that's not the right way for every application. E.g. in
compiler building it's maybe not the right approach, in this case very
conscious coding is required. That's why we originally decided for
lex, to allow the user to throw an exception but presented it to the
user in the form of a straightforward error type, which could be
handled by the parser in a uniform way.

Even more: following your new proposal, the one, Fergus agreed on, it
would be impossible to incorporate into Moose an all at once error
handler. Every error has to be handled by the Moose user. That's bad,
very bad. Very, very bad. Maybe yet another "please" would be required
?



-- 
Holger Krug
hkrug at rationalizer.com
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list