[E-Lang] Confusion
Terry Stanley
tstanley@cocoon.com
Thu, 16 Aug 2001 08:31:21 -0700
At 03:02 AM 8/16/01 -0700, steve jenson wrote:
>def counter {
> to incr() :any { println("counter was incr()'d"); x += 1}
> to getX() :any { x }
>}
Realize that this println message is displayed in the server window, not the
client window.
>? def newX := farCounter <- incr()
># value: <Eventual ref>
This is correct. Since the incr message is sent with an eventual send, newX
starts out as an eventual ref. There are two ways to see the resolved value.
If interacting with Elmer, wait a couple of seconds and type newX. From
inside a program, use the when-catch construct.
>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.
This was a good idea. We were able to connect to your server in Elmer. The
following updoc script is our transcript , including an example of when-catch.
? introducer onTheAir()
# value: ["3DES_SDH_M2", "3DES_SDH_M"]
? def sr := <cap://66.92.8.63:3575/08TsZ_LYmtuAVuLZoDFX8j3Re7O6/QfWE9V6br29mY9eS27aFI9fyGam>
# value: <SturdyRef>
? def farCounter := sr liveRef()
# value: <Eventual ref>
? def xVow := farCounter <- getX()
# value: <Eventual ref>
? xVow
# value: 8
? def xNextVow := farCounter <- incr()
# value: <Eventual ref>
? xNextVow
# value: 9
? when (xNextVow) -> done(xNext) {
> println(`next: $xNext`)
> } catch prob {
> println(`oops: $prob`)
> }
# value: <Eventual ref>
?
next: 9
?
Let us know if you have any more questions.
--Terry