[mercury-users] Exception file......
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Oct 16 17:49:06 AEST 2002
On 16-Oct-2002, Noel Pinto <cool4life at rediffmail.com> wrote:
> In the following piece of code, I can understand how to use
> 'throw' from the file 'exception'.
>
> read_int(Int) -->
> io__read_line_as_string(Result),
> { Result = ok(Line),
> remove_suffix(Line, "\n", IntString),
> string__to_int(IntString, IntVal)
> ->
> Int = IntVal
> ;
> throw("invalid entry, end-of-file, or I/O
> error")
> }.
>
> I would like to know various other pred, mode and inst mentioned
> in the file 'exception'. I mean, I want to know how to use it. Plz
> do show a small piece of code for each.
There are some example uses of most of the exception handling routines
in the files in the directory hard_coded/exceptions in the Mercury test
suite (the mercury-tests distribution).
There are some example uses of try_io in the sources for the Mercury compiler.
Just grep for it.
That is, use the Unix (and cygwin) command `grep', e.g.
grep -n try_io compiler/*.m
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list