[mercury-users] Structure reuse
Nancy Mazur
Nancy.Mazur at cs.kuleuven.ac.be
Tue Jul 15 18:48:09 AEST 2003
>>Even if you let the programmer annotate unique modes by hand, I thought
>>the philosophy of the Mercury compiler was always not to trust the
>>programmer, and therefore an automatic verification of these annotations
>>should still be done.
>
>
> That's right, so if the data structure isn't used in a single-threaded
> way, the compiler will report an error showing where. If you leave it all
> up to the compiler, you're on your own if the reuse doesn't happen.
If the user is interested, the compiler can produce interesting feedback
as to why reuse at some place wasn't possible (example: some alias with
some live structure that the programmer overlooked)...
>>But some cooperation human-compiler is interesting: let the compiler
>>deduce automatically the reuse, let the programmer indicate some hints
>>where reuse should be possible according to him, and then provide the
>>adequate feedback if the two views do not match.
>
> That's what unique modes are for.
Yes and no. The unique modes are too strict as such. If you want to use
unique modes, you need to have the discipline to write these modes for
each predicate or function that manipulates the data structure you're
interested in reusing...
It would be more user-friendly to use the unique modes only for those
predicates where the programmer thinks reuse may be possible, and let
the compiler figure out the rest of the predicates...
Nancy
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list