[E-Lang] Confusion

steve jenson stevej@sieve.net
Thu, 16 Aug 2001 03:02:49 -0700


In working on some E code to serve as an exmple to others, I've run into
a gap in my knowledge:

First, I have an E script called server.e:

---
#!/usr/bin/env e

def x := 1

def counter {
     to incr() :any { println("counter was incr()'d"); x += 1}
     to getX() :any { x }
}

introducer onTheAir()
def sr := sturdyRef(counter)
def uri := introducer sturdyToURI(sr)
println(uri)

interp blockAtTop()
---

And I have an elmer transcript called client.updoc:

---
? introducer onTheAir()
# value: ["3DES_SDH_M2", "3DES_SDH_M"]

? def uri := "cap://66.92.8.63:3575/08TsZ_LYmtuAVuLZoDFX8j3Re7O6/QfWE9V6br29mY9eS27aFI9fyGam"
# value: "cap://66.92.8.63:3575/08TsZ_LYmtuAVuLZoDFX8j3Re7O6/QfWE9V6br29mY9eS27aFI9fyGam"

? def sr := introducer sturdyFromURI(uri)
# value: <SturdyRef>

? def farCounter := sr liveRef()
# value: <Eventual ref>

? def newX := farCounter <- incr()
# value: <Eventual ref>

? def newY := farCounter
# value: <Eventual ref>

? newY <- incr()
# value: <Eventual ref>

? newY <- getX()
# value: <Eventual ref>

? farCounter <- incr()
# value: <Eventual ref>

? newY <- incr()
# value: <Eventual ref>

? def newX := farCounter <- incr()
# value: <Eventual ref>

? newX
# value: 6

? newY <- incr()
# value: <Eventual ref>

? newX
# value: 6

? newY
# value: <Eventual ref>

?
? def newX := farCounter <- incr()
# value: <Eventual ref>

? newX
# value: 8
---

I think this transcript shows my confusion about how to acquire the value
held in the variable x by server.e's counter object.

help! Where is my thinking not lining up properly? 


regards,
steve

PS, the cap is still online (at least until I wake up tomorrow morning and
turn it off) if anybody out there wants to play with it. Not that it's
super-exciting.

-- 
steve jenson <stevej@sieve.net> http://sieve.net/
PGP fingerprint: 79D0 4836 11E4 A43A 0179  FC97 3AE2 008E 1E57 6138