eval(readFile("Worlds_Compiled")) w = new world in w { 0.fact = function() { return 1 } number.fact = function() { return this * (this - 1).fact() } } 0.fact w.get(0, "fact") w.get(5, "fact") w.send(5, "fact") w.call(function() { return 5.fact() }) w2 = w.call(function() { return new world }) in w2 { alert(5.fact()) } worldProto.makeChild = function() { return this.call(function() { return new world }) } w2 = w.makeChild() ... w = new world in w { node = {} lit = new node() lit.initialize = function(val) { this.val = val } binop = new node() binop.initialize = function(op, x, y) { this.op = op; this.x = x; this.y = y } expr = new binop("+", new lit(1), new binop("*", new lit(2), new lit(3))) } w2 = w.makeChild() in w2 { node.printString = function() { this.subclassResponsibility() } lit.printString = function() { return this.val } binop.printString = function() { return "(" + this.x.printString() + this.op + this.y.printString() + ")" } expr2 = new binop("*", new lit(6), new lit(7)) alert(expr.printString()) alert(expr2.printString()) }