Repair syndicate/js just like commit 1fa5167
repaired syndicate/rkt.
This commit is contained in:
parent
1fa5167e20
commit
06224b52a8
|
@ -0,0 +1,55 @@
|
|||
// bin/syndicatec compiler/demo-synthetic-patch-2.js | node
|
||||
//
|
||||
// Analogous example to syndicate/racket/syndicate/examples/actor/example-synthetic-patch-2.rkt.
|
||||
//
|
||||
// Symptomatic output:
|
||||
//
|
||||
// Outer value 4 = 4
|
||||
// Value 0 = 0
|
||||
// Value 1 = 1
|
||||
// Value 2 = 2
|
||||
// Value 3 = 3
|
||||
//
|
||||
// Correct output:
|
||||
//
|
||||
// Outer value 4 = 4
|
||||
// Value 0 = 0
|
||||
// Value 1 = 1
|
||||
// Value 2 = 2
|
||||
// Value 3 = 3
|
||||
// Value 4 = 4
|
||||
// Value 5 = 5
|
||||
|
||||
var Syndicate = require('./src/main.js');
|
||||
|
||||
assertion type mapping(key, value);
|
||||
assertion type ready();
|
||||
|
||||
ground dataspace {
|
||||
spawn {
|
||||
field this.ofInterest = 0;
|
||||
during ready() {
|
||||
on asserted mapping(this.ofInterest, $v) {
|
||||
console.log("Value", this.ofInterest, "=", v);
|
||||
this.ofInterest += 1;
|
||||
}
|
||||
}
|
||||
on asserted mapping(4, $v) {
|
||||
console.log("Outer value", 4, "=", v);
|
||||
}
|
||||
}
|
||||
|
||||
spawn {
|
||||
assert mapping(0, 0);
|
||||
assert mapping(1, 1);
|
||||
assert mapping(2, 2);
|
||||
assert mapping(3, 3);
|
||||
assert mapping(4, 4);
|
||||
assert mapping(5, 5);
|
||||
on start {
|
||||
react {
|
||||
assert ready();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -88,8 +88,14 @@ Actor.prototype.quiesce = function() {
|
|||
if (!facet.terminated) {
|
||||
withCurrentFacet(facet, function () {
|
||||
var patch = Patch.retract(__).andThen(endpoint.subscriptionFn.call(facet.fields));
|
||||
var newInterests = patch.prunedBy(facet.actor.mux.interestsOf(endpoint.eid));
|
||||
var newlyRelevantKnowledge =
|
||||
Patch.biasedIntersection(facet.actor.knowledge, newInterests.added);
|
||||
var r = facet.actor.mux.updateStream(endpoint.eid, patch);
|
||||
Dataspace.stateChange(r.deltaAggregate);
|
||||
facet.handleEvent(_Dataspace.stateChange(new Patch.Patch(newlyRelevantKnowledge,
|
||||
Trie.emptyTrie)),
|
||||
true);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue