[m-dev.] diff: type_name/1 et al
Fergus Henderson
fjh at cs.mu.oz.au
Fri Apr 25 20:33:34 AEST 1997
Peter Schachte, you wrote:
>
> On Thu, 24 Apr 1997, Fergus Henderson wrote:
>
> > > Why shouldn't type_of(in, out) just be multi? Why not allow it to
> > > generate the names of equivalent types?
> >
> > Because that would be difficult to implement, inefficient, and not useful.
>
> Ok, then why not just implement
>
> :- mode type_of(in, in) is semidet?
With what semantics exactly?
I think that would raise the same problems as the `type_of(in, out) is multi'
version.
> The type_of(in, out) is cc_multi version seems like it's not going to do
> anything useful very often. If you want to get "the" type name, you
> probably want the canonical one, rather than just picking one of the
> equivalent names at random.
The problem is that the "canonical" one is often _not_ the one that the
user really wants to know about. It includes implementation
details that the user doesn't care about, and loses information that
is useful for the user. For example, `map' may be
implemented as `tree234', but from a user's perspective, that is
irrelevant. `map' conveys more information. Also, `var' and
`pred_id' may both be `int', but if possible the user would prefer
not to lose the distinction.
So that's the argument against the canonical version.
On the other hand, for any other version, it is very difficult
to specify the semantics exactly without overly constraining the
compiler. Thus we'd like to leave the semantics unspecified
(i.e. cc_multi).
--
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