[m-dev.] io__write and arrays

Fergus Henderson fjh at cs.mu.oz.au
Tue Apr 8 14:26:09 AEST 1997

Peter Schachte, you wrote:
> Actually, there should probably be at least three standard ways to write
> things:  (1) so that it's guaranteed they can be read back in, regardless
> of the operators in force at the time; (2) so they look reasonably good,
> but still reflecting the internal representation; and (3) "pretty,"
> reflecting the entity represented.  These correspond to display, write,
> and print in Prolog.

I agree with this and I think we should use the same names as Prolog.

Furthermore we should also provide binary I/O.

> But all of this goes beyond the C interface.  These things should all be
> possible for ordinary Mercury types, as well.  I think the place to put
> this facility is in the type definition syntax, or perhaps an extra
> declaration, but not as part of the C interface.

Type classes provide an obvious means of supporting "pretty" printing of
user-defined types, so that is something that should probably wait
until we have type classes.

`display' and `write' for user-defined Mercury types should be handled
automatically, using arg & functor and the predicates exported from
library/ops.m.  For user-defined types that are actually defined using
C code, then in the long term we should probably also do this with type
classes, but in the short term, we should at least handle the types
defined in the standard Mercury library, in particular arrays.

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         |     -- the last words of T. S. Garp.

More information about the developers mailing list