[m-dev.] diff: io__call_system/4
Zoltan Somogyi
zs at cs.mu.oz.au
Mon Oct 6 09:17:18 AEST 1997
> I disagree completely. This is useful information which a program should
> be allowed to act on sensibly.
>
> I agree, BTW, that the "final" version should throw an exception in this
> case.
>
> 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 think the predicate implemented in pragma C code should be exactly as it is
in Chris's posting, but that the predicate should be internal to the module.
There should be an exported version that translates the encoded integer
into the type Andrew proposes; users of this predicate can write their own
code to handle the case when the command was terminated by a signal. In case
they do not wish to do so, there should be another exported predicate
that also decodes the integer and aborts if it indicates termination by
signal.
The type conversion should be in Mercury code because allocating memory
in C code should be avoided if possible.
Zoltan.
More information about the developers
mailing list