Avoid use of Symbols in during...spawn Instance protocol

This commit is contained in:
Tony Garnock-Jones 2018-11-04 19:38:46 +00:00
parent 4f8a1622ea
commit 8a0dfb12c6
3 changed files with 8 additions and 4 deletions

View File

@ -19,6 +19,7 @@
const Struct = require('./struct.js'); const Struct = require('./struct.js');
const Skeleton = require('./skeleton.js'); const Skeleton = require('./skeleton.js');
const RandomID = require('./randomid.js');
const Dataspace = require('./dataspace.js'); const Dataspace = require('./dataspace.js');
const Ground = require('./ground.js'); const Ground = require('./ground.js');
const Assertions = require('./assertions.js'); const Assertions = require('./assertions.js');
@ -29,6 +30,7 @@ module.exports.Immutable = require('immutable');
module.exports.Bag = require("./bag.js"); module.exports.Bag = require("./bag.js");
module.exports.Struct = Struct; module.exports.Struct = Struct;
module.exports.Skeleton = Skeleton; module.exports.Skeleton = Skeleton;
module.exports.RandomID = RandomID;
module.exports.__ = Struct.__; module.exports.__ = Struct.__;
module.exports._$ = Skeleton._$; module.exports._$ = Skeleton._$;
@ -45,6 +47,9 @@ module.exports.Instance = Assertions.Instance;
module.exports.bootModule = Ground.bootModule; 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 () { module.exports.genUuid = function () {
return Symbol('@syndicate-lang/core'); return uuidPrefix + uuidIndex++;
}; };

View File

@ -16,9 +16,8 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
import { Observe, Dataspace } from "@syndicate-lang/core"; import { RandomID, Observe, Dataspace } from "@syndicate-lang/core";
const randomId = RandomID.randomId;
import { randomId } from "./randomid";
import * as P from "./protocol"; import * as P from "./protocol";
export * from "./protocol"; export * from "./protocol";