[comp.lang.prolog] Garbage collecting names in Prology

brady@swift.cs.tcd.ie (04/12/91)

In article <1600027@otter.hpl.hp.com>, sfk@otter.hpl.hp.com (Steve Knight) writes:
> This is an interesting question.  The Poplog Prolog system, which is the
> one I normally use, collects all inaccessible atoms.  Atoms are 
> accessible either from the "dictionary" or from the currently executing
> context (or because they reside in the constant portion of the process.)

A related question is whether Poplog Prolog has the built-in 'current_functor',
and if it has, what does current_functor give you?

For instance, if current_functor gives you access to all the names that the
system has ever seen, whether connected to the current process or not, then
if you garbage collect the inaccessible names, the set of names that
'current_functor' can give access to changes, hence its behaviour
is directly affected by a garbage collect. This seems undesirable.

On the other hand, if current_functor gives access only to those names that
are accessible to the process, then the problem disappears. The big difficulty
here would be the cost of keeping this kind of functor information up-to-date.

It seems therefore that implementers are between a rock and a hard place in
this case, hence my question in the first place.

Mike
brady@cs.tcd.ie

sfk@otter.hpl.hp.com (Steve Knight) (04/17/91)

> A related question is whether Poplog Prolog has the builtin 'current_functor',
> and if it has, what does current_functor give you?

It gets functors named in 'predicate positions' and not those named
in 'argument positions'.  Therefore its behaviour doesn't change across a 
GC -- at the expense of being unable to easily find some other names.

> It seems therefore that implementers are between a rock and a hard place in
> this case, hence my question in the first place.

I'm inclined to agree.  But on the other hand it seems like a fairly useless
predicate so implementors can find sub-solutions without much complaint.

Steve