Пример #1
0
    def set(self, val):
        self.validate(self.getValidator(), val);
        b = self.getThreadBinding()
        if b is not None:
            if currentThread() != b.thread:
                raise IllegalStateException("Can't set!: " + str(sym) + " from non-binding thread")
            b.val = val
            return self

        raise IllegalStateException(str("Can't change/establish root binding of: "+ str(sym) +" with set"))
Пример #2
0
def pushThreadBindings(bindings):
    f = dvals.get(lambda: Var.Frame())
    bmap = f.bindings
    bs = bindings.seq()
    while bs is not None:
        e = bs.first()
        v = e.getKey()
        if not v.dynamic:
            raise IllegalStateException("Can't dynamically bind non-dynamic var: " + str(v.ns) + "/" + str(v.sym))
        v.validate(v.getValidator(), e.getValue())
        v.threadBound = True
        bmap = bmap.assoc(v, Var.TBox(currentThread(), e.getValue()))
        bs = bs.next()
    dvals.set(Var.Frame(bmap, f))