Same object, two representations. This is the intended syntax.
>canonical object graph
(object counter
(position 0)
(on advance (speed elapsed)
(set position (+ position (distance speed elapsed))))
(distance :knight
(fn (speed elapsed) (* speed elapsed))))
>high-level Neo and Knight
object counter {
position = 0
on advance(speed, elapsed) {
position = position + distance(speed, elapsed)
}
knight distance(speed, elapsed) = speed * elapsed
}
Both boxes define the same object, slot, message handler, and pure function. Neo handles the state change. Knight does the calculation.
The idea I borrowed from Lisp is that ordinary programs can inspect and rewrite code. The object graph gives tools that representation. The high-level view makes the same program easier to scan: the message handler reads like an action, and the calculation reads like a formula. Editing either view changes the same underlying graph.