From jan@swi.psy.uva.nl Tue Nov 6 20:42:08 2001 Received: from gollem.swi.psy.uva.nl (root@gollem [145.18.152.30]) by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id fA6Jg8t27332; Tue, 6 Nov 2001 20:42:08 +0100 (MET) Received: (from jan@localhost) by gollem.swi.psy.uva.nl (8.11.3/8.11.3/SuSE Linux 8.11.1-0.5) id fA6Jg7e32093; Tue, 6 Nov 2001 20:42:07 +0100 Date: Tue, 6 Nov 2001 20:42:07 +0100 Message-Id: <200111061942.fA6Jg7e32093@gollem.swi.psy.uva.nl> From: Jan Wielemaker Subject: Re: [SWIPL] no copy semantics for PlTerm, in the C++ interface To: Volker Wysk , , Jan Wielemaker In-Reply-To: Volker Wysk's message of Tue, 6 Nov 2001 18:48:36 +0100 (CET) Phone: +31 - 20 - 525 6121 > > 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