[m-rev.] diff: handle user defined equality in rtti_implementation__deconstruct

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Dec 1 02:28:52 AEDT 2002


On 30-Nov-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> fjh wrote:
> 
> > On 30-Nov-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> > > fjh wrote:
> > > > On 29-Nov-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> > > > > fjh wrote:
> > > > > > On 29-Nov-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> > > > > > > +handle_usereq_type(Term, TypeInfo, TypeCtorInfo,
> > > > > > > + TypeCtorRep, NonCanon, Functor, Arity, Arguments) :-
> > > > > > > + ( NonCanon = do_not_allow,
> > > > > > > + error("attempt to deconstruct noncanonical term")
> > > > > > > + ; NonCanon = canonicalize,
> > > > > > > + Functor = expand_type_name(TypeCtorInfo, yes),
> > > > > > > + Arity = 0,
> > > > > > > + Arguments = []
> > > > > >
> > > > > > The two lines above look wrong -- there should at least be an XXX
> > > comment
> > > > > > there.

Sorry, my mistake.  The code is correct.

A comment there might be helpful, though.

For types with user-defined equality, we simply return the type name.
Thus the information that we return is not sufficient to reconstruct
the value that was deconstructed.  We provide as much information as
we can without examining the representation.

P.S.

IMHO it would be slightly nicer to return

	Functor = "<" ++ expand_type_name(TypeCtorInfo, yes) ++ ">".

rather than

	Functor = expand_type_name(TypeCtorInfo, yes)

since this might make it a little clearer that what is being returned
is actually a type name not a functor name.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list