# Copyright 2005-2008 Kevin Reid, under the terms of the MIT X license # found at http://www.opensource.org/licenses/mit-license.html ................ import ? # value: ? def allOf := # value: ? allOf([1, 2, 3], def _(x) :any {return x < 4}) # value: true ? def eLoader := # value: ? eLoader["tools.collect.allOf"] # value: ? def ["tools.collect.allOf" => a, > "elib.ref.makeProxy" => m] | _ := eLoader > [a, m] # value: [, ] ? :DeepFrozen # value: ? .fetch("org.erights.e.tools.collect.allOf", fn {throw("bang")}) # value: ? .fetch("a.fqn.with.no.referent", fn {throw("bang")}) # problem: bang DeepFrozen importing we're assuming that allOf can be used as an example of non-deep-frozen import ' ? allOf == # value: false ? == # value: true Uncall/unget ? [.optUncall(53)] # value: [null] ? [.optUncall()] # value: [[, "get", ["org.erights.e.elang.evm.makeNounExpr"]]] ? [.optUnget()] # value: ["org.erights.e.elang.evm.makeNounExpr"] XXX uncall/unget by and of package loaders XXX uncall of all varieties of subloaders (vm-node is a bad general example) Uncall/unget on emakers ? [ == , > .optUnget()] # value: [true, "org.cubik.cle.test.importUncall.ok"] ? [ == , > .optUnget()] # value: [false, null] ? [ == , > .optUnget()] # value: [true, null] ? [ == , > .optUnget()] # value: [true, null] ? [ == , > .optUnget()] # value: [true, null] emaker loading rebinds some nouns (as of this writing, trace[ln] and ExitViaHere), so check their guards. XXX it would be better to extract the environment and pass it out of the emaker, and test it here, but as we do not yet have either proper meta.getState() or &&noun, we can't do that. ? # value: "ok" , ? # value: ? # value: see ref.updoc for Ref ? # value: ? # value: Uncaller ? # value: ? # value: ? .optUncall() # value: [, "get", ["import:*"]] ? # value: ? .getText().split("\n")[0] # value: "# Copyright 2005-2007 Kevin Reid, under the terms of the MIT X license" safeScope ? safeScope["int"] # value: int ? safeScope.with("pi", 3.14159)["pi"] # value: 3.14159 Every binding in the safeScope exposes its value in its guard, since all the values are well-known. ? safeScope.bindings().fetch("false", throw).getGuard() # value: Same[<& false>] ? safeScope.bindings().fetch("int", throw).getGuard() # value: Same[] ? safeScope.bindings().fetch("int", throw).getGuard().getAllowed()[] # value: int Everything in the safeScope should be DeepFrozen, on general principles and because otherwise the magic lazy-eval-slots are incoherent; testing this. ? for `&@noun` => &thing in safeScope { > if (!DeepFrozen.isDeepFrozen(thing)) { println(`$noun ($thing) ought to be DeepFrozen`) } > } > print("ok") # stdout: near (near) ought to be DeepFrozen # opaque__uriGetter () ought to be DeepFrozen # promiseAllFulfilled () ought to be DeepFrozen # rcvr (rcvr) ought to be DeepFrozen # rx__quasiParser () ought to be DeepFrozen # term__quasiParser () ought to be DeepFrozen # ok XXX fix things until the above test produces no errors XXX scope#get/1 with funny/nonexistent keys