Miranda whenMoreResolved

From Erights

(Difference between revisions)
Jump to: navigation, search
m (timing)
Line 13: Line 13:
  ? var r := null
  ? var r := null
  > def ret := 1 <- __whenMoreResolved(fn x { r := x + 1 })
  > def ret := 1 <- __whenMoreResolved(fn x { r := x + 1 })
 +
> interp.waitAtTop(ret)
 +
> ret
  # value: <Promise>
  # value: <Promise>
   
   

Revision as of 16:02, 10 June 2009

__whenMoreResolved/1 is a Miranda message.

__whenMoreResolved/1

Signature: __whenMoreResolved(reactor :OneArgFunc) :void

The overall effect is to notify the reactor when the reference is resolved, or is closer to being resolved — in particular, when a resolution has changed its target to another vat. XXX poor terminology

If the recipient is a near ref, then the Miranda method should be:

to __whenMoreResolved(reactor) {
    reactor <- run(recipient)
    return null
}
? var r := null
> def ret := 1 <- __whenMoreResolved(fn x { r := x + 1 })
> interp.waitAtTop(ret)
> ret
# value: <Promise>

? r
# value: 2

? [ret]
# value: [null]

XXX Above tests do not check for reactor<-run rather than reactor.run

If the recipient is a local promise then it should buffer and forward the message normally.

If the recipient is a remote promise then XXX Specify the CapTP-related behavior.

Personal tools
more tools