You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current model for how the activity loop is driven, where a periodic timer calls advanceToTime, is extremely brittle, error-prone, and complex to modify.
For example:
just look at the mess that is earlyEvaluationSpecialCase
the 3-level deep match/if/else logic is complex
invalid/impossible states like "rolling off the end of a streak but the streak is empty somehow" exist in the control flow that need to be accounted for
Plus, I obviously want to be using Fritter here to have a nice reified model of time
However, this migration presents significant challenges. Inverting this logic so that it is expressed in terms of changes to timers would naively mean we need to be statefully keeping track of timers for start/end of every interval in our inventory, which is not ideal either.
What are the events that can affect the time of the next state change? All of these depend on the active interval type.
User takes an action:
With an active Pomodoro interval, if it is evaluated, that starts the next Duration from the StreakRules.
In principle, you could end a Break early too, and maybe we should add the ability to do that.
Same deal with abandoning the intention associated with an active pomodoro (oops this one's not even implemented yet at all!)
In an Idle interval, rules for recurring session start change, which should set a timer for the start of the next automatic session, to start StartPrompts.
In a StartPrompt, the session's duration is changed. (It's not valid to move the start time of a session that has already started.)
When a grace period is ended by a Pomodoro starting, the next event moves to the end of the Pomdoro.
Time Passes:
When a Pomodoro expires, we start the next Break
When a break expires, we start the next StartPrompt
When a grace period expires, the current streak ends, and we go to the next grace period.
In a StartPrompt, it expires, which should schedule the next StartPrompt.
When an Idle interval expires, we start the session that ends it
The current model for how the activity loop is driven, where a periodic timer calls advanceToTime, is extremely brittle, error-prone, and complex to modify.
For example:
earlyEvaluationSpecialCase
Plus, I obviously want to be using Fritter here to have a nice reified model of time
However, this migration presents significant challenges. Inverting this logic so that it is expressed in terms of changes to timers would naively mean we need to be statefully keeping track of timers for start/end of every interval in our inventory, which is not ideal either.
What are the events that can affect the time of the next state change? All of these depend on the active interval type.
User takes an action:
Time Passes:
This sounds like it might be a job for https://github.com/glyph/automat/
The text was updated successfully, but these errors were encountered: