[m-dev.] diff: io__call_system/4
Andrew Bromage
bromage at cs.mu.oz.au
Mon Oct 6 14:12:27 AEST 1997
G'day all.
I wrote:
> Perhaps a better interface for now is to return a type such as:
>
> :- type io__system_result(T)
> ---> ok(T)
> ; signal(int)
> ; error(io__error).
I've been having a think about this. Perhaps a better solution is to
turn io__error into a discriminated union type internally.
:- type io__error
---> message(string)
; signal(int).
io__error_message(message(Msg), Msg).
io__error_message(signal(S), Msg) :-
string__format("Aborted with signal %i", [i(S)], Msg).
Then introduce some predicates to get the signal information out of
the io__error for those who need that information.
Zoltan wrote:
> The type conversion should be in Mercury code because allocating memory
> in C code should be avoided if possible.
Agreed.
Cheers,
Andrew Bromage
More information about the developers
mailing list