Re: Reentrancy via Recursion

Kevin Reid <[email protected]>
Newsgroups gmane.comp.lang.e.general
Message-ID <[email protected]>
On Feb 26, 2009, at 7:18, Toby Murray wrote:

> However, this kind of nondeterminism can already be created in E.
> Suppose we have a variable 'InUse' and Bob is now
>
> def Bob() {
>   if (InUse) {
>       throw "in use"
>   }
> }
>
> Bob is nondeterministic in that Bob() will fail sometimes if called  
> in a
> context during which InUse is true.
>
> I see that the first case does reveal information that the second
> doesn't -- about the call-stack. However, I don't see how it adds any
> more nondeterminism than is already present.


Okay, my revised statement:

Checking the call stack *for occurrences of yourself* is safe, and  
equivalent to maintaining state. An object which uses this "I call  
you, don't call me" operator cannot be considered DeepFrozen.

Furthermore, it can be implemented user-level by a library using an in- 
use flag:

def [Bob, protectedCall] := prohibitMarkedReentrance(def Bob0() {
   protectedCall(Carol).hello(Bob) # instead of Carol.hello(Bob)
}}

Here Bob is a wrapper around Bob0 which checks the flag which is set  
by protectedCall.

-- 
Kevin Reid                            <http://homepage.mac.com/kpreid/>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.