#Object may be implemented as a primitive class, so that we have fast set, get, etc. Although it would be a good test of the system to be able to implement the Object class using Perpheon. 'Object class '?set { } method 'get { } method 'set { } method 'unset { } method end.of.class 'Window class 'create { ... Add some instance variables to $self ... } method '-destroy.window { 'destroy $self } method '-set.name { 'name 2 list '?set self } method '-set.rgb { 'rgb 2 list '?set self } method end.of.class Object 'w set 'Window 'inherit $w "Hello World" '-set.name $w #A list is passed to -set.rgb, and -set.rgb constructs a parent list. 200 200 255 3 list '-set.rgb $w ----- So: ' is our quote character (like LISP) method pops two strings, and associates the compiled code body with the method name. list pops one N, and then pops N and constructs a new list on the top of the stack. Object creates a new object from the heap. 'Window 'inherit w causes the Window class to be used during lookup during compilation of a message sent to w. nil =? then abort otherwise $self compiles to push [id of current object] self compiles to: push [id of current object] >OBJ-STACK method.lookup (pop 1 and do lookup using the object on the Object stack) nil = then abort otherwise execute DROP.OBJ.STACK We need an object stack, so that a method may invoke other methods for a different class or object. lindex, split, llength, lrange, head, tail ... We could make it like: list.index, split.into.list, list.length?, list.range. Or search.list, index. We could also do: in.list. An iterator would be quite useful. : foo to.ascii emit.char . 4 5 6 3 list 'foo for.each This seems to do so much with so little: : foreach lookup nil =? then abort otherwise >EXEC dup # The list >CONTROL head # Head drops the list and gives us the head of that list. do EXEC.EXECUTE ? then >CONTROL repeat otherwise DROP.EXEC I think we can still simplify it.