-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
Coming from non-game environments (FP inspired Javascript notably, like well known flux architecture or even react at its core); I was heavily surprised the philosophy of State update has mutation at its core.
To challenge that, asking here a naive but important question :
Why not taking a non-mutative approach ?
ie
onTick(prevState: InternalState, ctx: Context, timeDelta: number): InternalState {
return {
...prevState,
testValue: 1
}
}instead of
onTick(state: InternalState, ctx: Context, timeDelta: number): void {
state.testValue = 1
}IMHO, this approach is broadly proven to be more easily testable and determinism-friendly
Metadata
Metadata
Assignees
Labels
No labels