Subject: Re: [SWIPL] no copy semantics for PlTerm, in the C++ interface

From: Jan Wielemaker <[email-masked]>
Date: Tue, 6 Nov 2001 20:42:07 +0100

> > Note that you
> > can use PL_put_* only on PlTerms you created yourself, *not* on the ones
> > you get as predicate arguments.
> 
> But you can still unify the terms passed as arguments? This means the
> arguments are of type "Term&" / "TermRef" from C++ perspective. Otherwise
> it would be "const Term&" / "const TermRef".

Yes, you can.  Thats the way to `return' values.  So, indeed a term is not
`const' (unless it is ground :-)

> > three versions of them ...  Besides, its not true.  If I do
> >
> >   term_t x = PL_new_term_ref();
> >   PL_put_atom_chars(x, "hello");
> >
> > x is an offset in the local stack and at that location *is* the atom
> > 'hello' (no, not the text, an atom is an integer with some tag-bits
> > and an offset into the atom-table).
> 
> Er, but you can still put a new value there? Such as
> 
> term_t x = PL_new_term_ref();
> PL_put_atom_chars(x, "hello");
> PL_put_atom_chars(x, "goodbye");

Yes.  After these x refers to the atom 'goodbye'

> Yes. I'll name it "prolog.h".

Fine!  Next you can make implementations for all Prolog systems :-)

	Regards --- Jan