[m-rev.] diff: tuples deconstruct implementation

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Nov 30 01:51:41 AEDT 2002


On 29-Nov-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> I have one concern with this change, and that is to do with the behaviour
> of type_ctor_and_args.
> 
> If one looks at the code for deconstructing du types, you will see that it
> jumps through many hoops to find the type_info for each argument.  I am
> not clear why that all needs to be done.  Could for instance that code
> be rewritten to use type_ctor_and_args instead?

I don't think so.  type_ctor_and_args gives the arguments of the type
constructor, not the types of the arguments of the data constructor.
E.g. for a type

	:- type foo(T1, T2) ---> mkfoo(int, list(T2), set(T1)).

type_ctor_and_args will give back [T1, T2], but the code for
deconstructing du types needs [int, list(T2), set(T1)].

Using type_ctor_and_args works OK for tuples, though, but only because
tuples are a special case where the types of the arguments of the
data constructor happens to be the same as the arguments of the type
constructor.

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