[m-rev.] diff: tuples deconstruct implementation

Peter Ross pro at missioncriticalit.com
Sat Nov 30 01:57:50 AEDT 2002


fjh wrote:
> 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.
>
Ahh that makes perfect sense.  Thank you.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.419 / Virus Database: 235 - Release Date: 11/14/2002

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