Subject: Re: Foreign language interface : PL_new_term_ref()

From: Jan Wielemaker <[email-masked]>
Date: Thu, 10 Aug 2000 11:37:09 +0200

> Just a quick question.
> I believe that any term created by PL_new_term_ref() is automatically destructed when it goes out o> f 
> scope. Could someone confirm?

Not really.  First of all, the scope is the embracement of
PL_open_foreign_frame() and its corresponding destruction
PL_close_foreign_frame().  This embracement is implicit around any function called
as a foreign predicate.  After the close, the *reference* is invalid.  The term
normally lives on until backtracking takes us before it was created or the
garbage collector removes it (if it has no other references).  When using
PL_discard_foreign_frame() instead of PL_close_foreign_frame(), not only
the references, but also the terms created and binding made are removed.

	--- Jan