[m-rev.] for review: [CTGC] user annotated sharing
Julien Fischer
juliensf at cs.mu.OZ.AU
Tue Jul 4 00:41:36 AEST 2006
On Mon, 3 Jul 2006, Nancy wrote:
>
> >> The thing is, I feel a little insecure with all the renaming in the
> >> different stages...
> >>
> >> * when parsing, the sharing information is in terms of the vars and
> >> typevars that are part of the same foreign_proc declaration.
> >
> > Yes.
> >
> >> * this is renamed when adding the pragma to the HLDS, so that everything
> >> becomes in terms of the vars/typevars used in the pred_info for that
> >> foreign_proc...
> >
> > No, at least for the vars. They can't be renamed because they might be used
> > within the foreign code. To add a foreign clause for a predicate we insert
> > a some extra unifications between the head of the predicate and the
> > foreign_proc goal. (For details see clauses_info_add_pragma_foreign_proc
> > in add_pragma.m.)
>
> Ok.
>
> > As for the type variables, I haven't checked but I can't think why they
> > would need to be renamed.
>
> Well, I do...
> The types are declared in the :- pred declaration of the given procedure.
> The sharing information is declared in the foreign_proc declaration of
> the procedure, which includes repeating the type declaration of the
> procedure because these types might be needed for declaring sharing.
> As the foreign_proc declaration will probably include some other
> variables as well (the arguments of the procedure), the id of the type
> variables might be different here in the proc-declaration, from their id
> in the pred-declaration.
>
> I mean, the type variable "T" in a pred declaration might correspond to
> var(1), while that same type variable in the proc declaration might
> correspond to var(5)... Which is why renaming is needed.
>
Yes, you're absolutely right ;-)
Julien.
--------------------------------------------------------------------------
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