Once again Hi Ladislav,

I believe I've figured ou why you think my function should have problems
with reentrancy.

You see that my function sets the object word of the methods object of the
object it is passed. Therefore, whatever ! is doing, it relies on the
expectation that the methods/object will have the same value it just set it
to, when ! continues. If ! is now evaulated again, with a different object
argument, then the first instance of ! will become confused because
methods/object has been changed by the second ! invocation.

The reason that *cannot* happen is because the second invocation of ! - as
in your previous example - is not evaluated until the first invoked ! has
already completed its execution.

That is because my version of ! does not evaluate the function it
retrieves. It just returns it! Since ! can never be called recursively,
there is no reentrancy problem. ! will definitely finish executing by the
time the function it retrieved is evaluated. Any modifications that
function may cause to methods/object is no longer relevant to the
successful execution of the first ! instance. Specifically, if the function
calls ! again ... even several times over, the same will continue to apply.
The first verion of ! already completed its execution, the second
invocation of ! will retrieve whatever function it is instructed to
retrieve and complete executing. Only then will the third invocation of !
occur, and when that invocation of ! modifies methods/object, the two first
invocations have already long ceased to execute. And so on.

Have I guessed correctly?

Continuing to suspensefully expect your response,

Elan

Reply via email to