Few months ago, I worked on a scripting languages, here is a snippet:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= package Kernel
rootclass Obj;
Obj { yourself ^ self } Obj { == other <primitive: 110> } Obj { ~~ other ^ (self == other) ifTrue: [false] ifTrue:[true] } Obj { = other ^ self == other } Obj { ~= other ^ (self = other) == false}
Obj {isNil ^ false} Obj {isNotNil ^ true} Obj {isBoolean ^false} Obj {isCollection ^false} Obj {isClass ^false} Obj {isSymbol ^false} Obj {isInteger ^false} Obj {perform: aSymbol <primitive: 83>}
Obj class {new ^ self basicNew} Obj class {basicNew <primitive: 70>} Obj class {isClass ^true}
class Boolean extends Obj; Boolean {isBoolean ^ true}
class False extends Boolean; False { ifTrue: block ^ self } False { ifFalse: block ^ block value } False { ifTrue: trueBlock ifFalse: falseBlock ^ falseBlock value } False { ifFalse: falseBlock ifTrue: trueBlock ^ falseBlock value } False { enot ^ True new } False { eor: other ^ other value} False { eand: other ^ False new}
class True extends Boolean; True { eifTrue: block ^ block value } True { eifFalse: block ^ self } True { enot ^ False new } True { eor: other ^ True new } True { eand: other ^ other value }
end -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Any comments are welcomed
Cheers, Alexandre
Am Apr 27, 2006 um 8:37 AM schrieb stéphane ducasse:
KernelPackage import: Point.
Package declare: 'ColoredPointPackage'.
Point < ColoredPpoint variables: 'x y' ; classvar: 'Foo'
ColoredPoint>>foo: zork <category: 'foobar'> <author: 'sd' date: '24/06/2006'> [ ljkljl ^ ]