|Did you know ...||Search Documentation:|
|Atoms and functors|
The following functions provide for communication using atoms and functors.
ATOM_nilis the same as
ATOM_dotis the same as
PL_new_atom("."). This is no long the case in SWI-Prolog version 7.
PL_new_functor(ATOM_dot,2). It is advised to use PL_get_list(), PL_put_list() or PL_unify_list() where applicable.
REP_MB. If len is
(size_t)-1, it is computed from s using strlen().
term_tnormally use PL_get_atom_chars() or PL_get_atom_nchars().
With the introduction of atom garbage collection in version 3.3.0, atoms no longer live as long as the process. Instead, their lifetime is guaranteed only as long as they are referenced. In the single-threaded version, atom garbage collections are only invoked at the call-port. In the multithreaded version (see chapter 10), they appear asynchronously, except for the invoking thread.
For dealing with atom garbage collection, two additional functions are provided:
Please note that the following two calls are different with respect to atom garbage collection:
PL_unify_atom_chars(t, "text"); PL_unify_atom(t, PL_new_atom("text"));
The latter increments the reference count of the atom
which effectively ensures the atom will never be collected. It is
advised to use the *_chars() or *_nchars() functions whenever