[mercury-users] io__error

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Aug 1 07:49:46 AEST 2002

On 31-Jul-2002, Michael Day <mikeday at yeslogic.com> wrote:
> :- type io__res(T)      --->    ok(T)
>                         ;       error(io__error).
> :- type io__error.      % Use io__error_message to decode it.
> What's the use? Why not just have error(string) and avoid passing back a
> type that the user can't do anything with and making it harder to use
> io__res types in other code?

The rationale for this design is that it allows future Mercury
implementations to provide more information about the kind of error,
without needing to change the interface of procedures which return
an io__res(T).

For example, on Posix systems it might be useful to know the errno value
associated with an io__error.

Another useful facility would be to support internationalization,
i.e. to provide error messages in different languages.

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