4 ms·
Nim toyed with this at some point as an "effect system". I wrote some pragmas (decorators) that ensured a certain function was only run on the network or GUI th
by captainmuon 5y ago
Nim toyed with this at some point as an "effect system". I wrote some pragmas (decorators) that ensured a certain function was only run on the network or GUI thread. In Python, I had the same, but as runtime assertions.
Another thing that you could do is in the command pattern for undo/redo, to make sure changes to your data model only happen from command objects. In Python, I had a decorator that said "when this property is set, assert that Action.do is on the call stack". It would be really powerful to be able to do that at compile time, too.