From 8a0dfb12c6fc06dfcec204c6a7e08e7ea6c2ac89 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Sun, 4 Nov 2018 19:38:46 +0000 Subject: [PATCH] Avoid use of Symbols in during...spawn Instance protocol --- packages/core/src/index.js | 7 ++++++- packages/{driver-browser-ui => core}/src/randomid.js | 0 packages/driver-browser-ui/src/index.js | 5 ++--- 3 files changed, 8 insertions(+), 4 deletions(-) rename packages/{driver-browser-ui => core}/src/randomid.js (100%) diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 96f9484..5fe027d 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -19,6 +19,7 @@ const Struct = require('./struct.js'); const Skeleton = require('./skeleton.js'); +const RandomID = require('./randomid.js'); const Dataspace = require('./dataspace.js'); const Ground = require('./ground.js'); const Assertions = require('./assertions.js'); @@ -29,6 +30,7 @@ module.exports.Immutable = require('immutable'); module.exports.Bag = require("./bag.js"); module.exports.Struct = Struct; module.exports.Skeleton = Skeleton; +module.exports.RandomID = RandomID; module.exports.__ = Struct.__; module.exports._$ = Skeleton._$; @@ -45,6 +47,9 @@ module.exports.Instance = Assertions.Instance; module.exports.bootModule = Ground.bootModule; +// These aren't so much "Universal" as they are "VM-wide-unique". +let uuidIndex = 0; +let uuidPrefix = '__@syndicate__' + RandomID.randomId(8) + '_'; module.exports.genUuid = function () { - return Symbol('@syndicate-lang/core'); + return uuidPrefix + uuidIndex++; }; diff --git a/packages/driver-browser-ui/src/randomid.js b/packages/core/src/randomid.js similarity index 100% rename from packages/driver-browser-ui/src/randomid.js rename to packages/core/src/randomid.js diff --git a/packages/driver-browser-ui/src/index.js b/packages/driver-browser-ui/src/index.js index 808fc1f..41e6bc2 100644 --- a/packages/driver-browser-ui/src/index.js +++ b/packages/driver-browser-ui/src/index.js @@ -16,9 +16,8 @@ // along with this program. If not, see . //--------------------------------------------------------------------------- -import { Observe, Dataspace } from "@syndicate-lang/core"; - -import { randomId } from "./randomid"; +import { RandomID, Observe, Dataspace } from "@syndicate-lang/core"; +const randomId = RandomID.randomId; import * as P from "./protocol"; export * from "./protocol";