[e-lang] Newbie question
Kevin Reid
kpreid at attglobal.net
Wed Mar 29 23:12:05 EST 2006
On Mar 29, 2006, at 10:00, Mariano Montone wrote:
> How can I perform a sequence of message sends atomically, in a
> transactional way, to a remote object? How can I get rid of
> something like that under the E model?
>
> In the following example, I would like carRcvr to stay in place
> between the moveTo messages.
>
> def carRcvr := carMakerRcvr <- ("Mercedes")
> carRcvr <- moveTo(2,3)
> carRcvr <- moveTo(5,6)
> carRcvr <- moveTo(7,3)
def sequence(target, messages) :void {
def deliverer implements PassByCopy {
to __optUncall() { ... }
to run(target) :void {
if (Ref.isEventual(target)) {
target <- __whenMoreResolved(deliverer)
} else {
for message in messages { E.callWithPair(target, message) }
}
}
}
deliverer(target)
}
sequence(carRcvr, [["moveTo", [2, 3]],
["moveTo", [5, 6]],
["moveTo", [7, 3]]]))
No existing E implementation supports 'implements PassByCopy' yet;
without it this will still work for 'atomic' sends in a single vat.
--
Kevin Reid <http://homepage.mac.com/kpreid/>
More information about the e-lang
mailing list