Objects in this language are defined as type
s. They have properties with
default values that can be overridden in the constructor literal syntax.
There are no methods, but instead have conditional message handlers. The handlers are scoped by the state of the internal properties. Depending on the state the value is in, different messages can be responded to in different ways.
Also values can actively delete themselves causing all references to them to be deleted and replaces with a null type that doesn't respond to anything. (thus freeing up memory)
type Ball:
life = 100
x = 0
y = 0
when life > 0:
on draw(canvas):
canvas.circle(x, y, 10, :red)
on update(ms):
life -= 1
x += ms
else:
delete
type Canvas:
on circle(x,y,r,c):
...
canvas = <Canvas>
ball = <Ball x=64 y=64>
ball.update(10)
ball.draw(canvas)
Actually the
else: delete
isn't needed since the runtime can prove that no state will ever change (unless we allow outside mutability beyond the initial setup). So if the end of a block ends in a state with no listeners, it can safely be replaces by the null type.