Repairs after merge

This commit is contained in:
Tony Garnock-Jones 2024-04-15 10:12:30 +02:00
parent 6d82440704
commit 7b9f0a6b16
3 changed files with 19 additions and 23 deletions

View File

@ -1,10 +1,10 @@
version 1 . version 1 .
Reflect = <reflect @thing #!any> . Reflect = <reflect @thing #:any> .
Type = <type @thing #!any @type TypeName> . Type = <type @thing #:any @type TypeName> .
Facet = <facet @thing #!any @facet #!any> . Facet = <facet @thing #:any @facet #:any> .
Attribute = <attribute @thing #!any @attribute any> . Attribute = <attribute @thing #:any @attribute any> .
TypeName = TypeName =
/ =entity / =entity
@ -18,19 +18,19 @@ TypeName =
EntityClass = <entity-class @value any> . EntityClass = <entity-class @value any> .
# Facet # Facet
FacetActor = <actor @actor #!any> . FacetActor = <actor @actor #:any> .
FacetAlive = <alive @alive bool> . FacetAlive = <alive @alive bool> .
FacetChild = <child @child #!any> . FacetChild = <child @child #:any> .
FacetParent = =root / <parent @parent #!any> . FacetParent = =root / <parent @parent #:any> .
FacetAssertion = <assertion @handle int @target #!any>. FacetAssertion = <assertion @handle int @target #:any>.
FacetInertPreventers = <inert-preventers @inertPreventers int> . FacetInertPreventers = <inert-preventers @inertPreventers int> .
# Actor # Actor
ActorName = <name @name any> . ActorName = <name @name any> .
ActorRoot = <root @root #!any> . ActorRoot = <root @root #:any> .
ActorStatus = =running / =done / <crashed @reason string> . ActorStatus = =running / =done / <crashed @reason string> .
# Space # Space
SpaceTaskCount = <task-count @taskCount int> . SpaceTaskCount = <task-count @taskCount int> .
SpaceActor = <actor @actor #!any> . SpaceActor = <actor @actor #:any> .
SpaceStatus = =running / =paused / =terminated . SpaceStatus = =running / =paused / =terminated .

View File

@ -99,7 +99,7 @@ export class Dataspace implements Partial<Entity> {
delete this._reflection; delete this._reflection;
} else { } else {
this._reflection = { mirror, assertionHandles: {} }; this._reflection = { mirror, assertionHandles: {} };
mirror.constProp(Refl.EntityClass(Symbol.for('dataspace'))); mirror.constProp(Refl.EntityClass<Ref>(Symbol.for('dataspace')));
this.handleMap.forEach((v, handle) => this.handleMap.forEach((v, handle) =>
this._reflection?.mirror.setProp( this._reflection?.mirror.setProp(
this._reflection.assertionHandles, this._reflection.assertionHandles,

View File

@ -1,15 +1,15 @@
/// SPDX-License-Identifier: GPL-3.0-or-later /// SPDX-License-Identifier: GPL-3.0-or-later
/// SPDX-FileCopyrightText: Copyright © 2023 Tony Garnock-Jones <tonyg@leastfixedpoint.com> /// SPDX-FileCopyrightText: Copyright © 2023-2024 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
import { Actor, Ref, RefImpl, Facet, LocalAction, Turn, assertionFrom } from './actor'; import { Actor, Ref, Facet, LocalAction, Turn, assertionFrom } from './actor';
import type { Handle, Assertable } from './actor'; import type { Handle, Assertable } from './actor';
import type { Field } from './dataflow'; import type { Field } from './dataflow';
import * as Refl from '../gen/mirror'; import * as Refl from '../gen/mirror';
import { Observe } from '../gen/dataspace'; import { Observe } from '../gen/dataspace';
import * as P from '../gen/dataspacePatterns'; import * as P from './pattern';
import { ActorSpace } from './space'; import { ActorSpace } from './space';
import { assertionFacetObserver, Dataspace } from './dataspace'; import { assertionFacetObserver, Dataspace } from './dataspace';
import { stringify, isEmbedded } from '@preserves/core'; import { stringify, isEmbedded, KeyedDictionary } from '@preserves/core';
export interface Reflectable { export interface Reflectable {
asRef(): Ref; asRef(): Ref;
@ -93,15 +93,11 @@ export function spawnMirror(sourceSpace: ActorSpace, targetSpace = new ActorSpac
tracer: (event, a, _ds, sig) => console.log('DS', event, stringify(a), sig), tracer: (event, a, _ds, sig) => console.log('DS', event, stringify(a), sig),
})); }));
t.assert(image, Observe({ t.assert(image, Observe({
pattern: P.Pattern.DCompound(P.DCompound.rec({ pattern: P.rec(Symbol.for('reflect'), P.bind()),
label: Symbol.for('reflect'),
fields: [P.Pattern.DBind(P.DBind(P.Pattern.DDiscard(P.DDiscard())))],
})),
observer: t.ref(assertionFacetObserver(a => { observer: t.ref(assertionFacetObserver(a => {
if (!Array.isArray(a)) return; if (!Array.isArray(a)) return;
const [thing_embedded] = a; const [thing] = a;
if (!isEmbedded(thing_embedded)) return; if (!isEmbedded(thing)) return;
const thing = thing_embedded.embeddedValue;
new Mirror(thing, image, sourceSpace, Turn.active); new Mirror(thing, image, sourceSpace, Turn.active);
})), })),
})); }));
@ -114,7 +110,7 @@ export function _asRef(
facet: Facet, facet: Facet,
): Ref { ): Ref {
if (x._reflectableRef === void 0) { if (x._reflectableRef === void 0) {
x._reflectableRef = new RefImpl(facet, { data: x, setMirror: m => x.setMirror(m) }); x._reflectableRef = new Ref(facet, { data: x, setMirror: m => x.setMirror(m) });
} }
return x._reflectableRef; return x._reflectableRef;
} }