[m-dev.] for review: changes to library/map.m

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Oct 21 21:19:54 AEST 1998


On 21-Oct-1998, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> 
> > 	Fix a cut-and-paste error in the comment for map__det_union where
> > 	it was referring to map__insert instead map__union.
> 
> Tha's fine.
> 
> > 	Delete the error message argument from map__det_union
> > 	and map__det_insert, for consistency with other det_* predicates,
> > 	and to make them easier to use.
> 
> Deleting the error message argument would improve consistency and make
> the predicates easier to use, but would make the predicates less useful.
> Recompiling the program in a grade that supports stack traces is not
> always feasible, and without that, a default error message from a library
> predicate is just not enough to nail down the problem.

The fact that you have to recompile the program in a grade that
supports stack traces in order to get a stack trace is an implementation
detail of the current implementation.  It is not necessarily
true of all implementations -- for example, if we ever develop a Java
backend, then it won't be true.  We shouldn't base the design of
the standard library on those kinds of things.

> If anything, I think that map__lookup etc should be changed to take
> an error message argument.  We can keep the exiting versions for backward
> compatibility.

The transition cost would be very high.  I don't think this is worth it.

And adding an error message argument to all those predicates
(there are about 30 of them in the standard library)
would be a major change which is not an appropriate thing to do
while we have a feature freeze on.

> Of course, what we actually need is the single predicate
> 
> p(Call, Msg) :-
> 	( Call ->
> 		true
> 	;
> 		error(Msg)
> 	).
> 
> but unfortunately it is not well typed or moded :-(

Actually it is well typed, just not well-moded.

-- 
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