I did this in Rust: World exposes World.advance() and World.state. This way World and, maybe, ActionQueues are the only things the UI needs to depend on.
What's especially cool in Rust, is that World.state is exposed via a shared reference, which makes it impossible for the UI to modify it directly, i.e., World.state is read-only data from the perspective of the UI, while being mutable via World.advance(). Doing the same in Java/Python requires wrapping State in a different type, that exposes only reading methods, while in Rust &State fields are all exposed and are still read-only.
I did this in Rust:
World
exposesWorld.advance()
andWorld.state
. This wayWorld
and, maybe,ActionQueue
s are the only things the UI needs to depend on.What's especially cool in Rust, is that
World.state
is exposed via a shared reference, which makes it impossible for the UI to modify it directly, i.e.,World.state
is read-only data from the perspective of the UI, while being mutable viaWorld.advance()
. Doing the same in Java/Python requires wrappingState
in a different type, that exposes only reading methods, while in Rust&State
fields are all exposed and are still read-only.