| Did you know ... | Search Documentation: |
| class-un_answer |
answers to methods, this table is called the answer
table internally.
If an object is made an attribute of another object, it will be
removed from the answer table and reclaimed by the garbage collector it
its reference count drops to zero. Object remaining in the answer table
are reclaimed if the context in which they where created is
ended. The main event-loop starts/ends such a context and likewise do
all method executions.
Now consider the code below, which produces an alphabetically ordered list of class-names:
?- new(Chain, chain),
send(@classes, for_all,
message(Chain, append, @arg1)),
send(Chain, sort).
With the above schema, Chain will be an answer object
after creation. It will be made a slot of the message
object, thus loosing its answer status. After the chain->for_all,
PCE will garbage collect the message. The reference count of the chain
drops to zero and thus the chain is reclaimed too.
This situation is common and therefore class code
sets the class<-un_answer
flags to @off.
This tells variable->send
not to remove the chain from the answer table.