Swift for instance will explicitly make iterating on a dictionary not deterministic (by randomizing the iteration), in order to catch weird bugs early if a client relies (knowingly or not) on the specific order the elements of the dictionary are ordered.
https://lukasmartinelli.ch/web/2014/11/17/php-dos-attack-rev...
Yes, the stdlib asyncio event loop does have deterministic scheduling, but that's an implementation detail and I would not rely on it for anything critical. Other event loops - for instance trio [1] - explicitly randomize startup order so that you won't accidentally write code that relies on it.
That sounds familiar...
https://stackoverflow.com/questions/39980323/are-dictionarie...
Don't you need something like a network clock to get deterministic replay?
It can't use immediate return on replay, or else the order will change.
This makes me twitchy. The dependencies should be better modelled, and idempotency used instead of logging and caching.
lexicality•1h ago
Yeah, great, my hello world program is deterministic.
What happens when you introduce I/O? Is every network call deterministic? Can you depend on reading a file taking the same amount of time and being woken up by the scheduler in the same order every time?
KraftyOne•59m ago
lexicality•45m ago
KraftyOne•13m ago
PufPufPuf•48m ago
Coincidentally I have been experimenting with something very similar in JavaScript in the past and there the scheduler also has the same property.