[m-dev.] diff: io__call_system/4

Fergus Henderson fjh at cs.mu.oz.au
Sat Oct 4 16:42:30 AEST 1997


Andrew Bromage, wrote:
> 
> You (Fergus Henderson) wrote:
> 
> > I think that is a poor interface.
> > We shouldn't encode values in integers like that.
> 
> > I think it would be better to just return error(_)
> > for cases where the invoked process was killed with a signal.
> 
> I disagree completely.  This is useful information which a program should
> be allowed to act on sensibly.

I agree that the information might be useful in some cases
(although I think those cases would be rare).

However, if we want to return that information, we should return
it in a discriminated union, not encoded in an int.

> 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'd be happy with that.  But it would break backwards compatibility.

We could solve the backwards compatibility issue by creating
a new predicate with the new interface, and keeping the existing
predicate (with the semantics that I suggested, i.e. signal(_)
gets translated to error(_)), possibly declaring it `pragma obsolete'.

However, that would be more work, and I think the situations in
which you care about the distinction between signal(N) and error(_)
are rare (I personally have never written a program that would
make use of that distinction).

Given this, it seems to me that the simplest and best option in the
short term is to just keep the existing interface and map signal(_)
to error(_).

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list