[m-dev.] diff: type_name/1 et al
Tyson Richard DOWD
trd at students.cs.mu.oz.au
Thu Apr 24 18:13:22 AEST 1997
> 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?
>
> 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.
Just because the declarative semantics are that one of the equivalent
names is chosen at random, doesn't mean that operationally, you won't
(usually) get a reasonable one. I'd like to see
map lookup failed - map type was map(var, goal_info).
of course, I wouldn't be too unhappy if it said
map lookup failed - map type was map(int, goal_info).
I think that one reason you want the *canonical* type_of is for
efficiency (so you don't have to collapse equivalences whenever you do
something with the type_info), and if you want the type_name, you either
- want to be as high up the equivalence chain as you can,
to get the most information about the type.
- want the canonical type, so you get the most basic information
about the type.
--
Tyson Dowd #
# Sign on refrigerator:
trd at cs.mu.oz.au # Refrigerate after opening.
http://www.cs.mu.oz.au/~trd # - C. J. Owen.
More information about the developers
mailing list