fix: final review findings
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
82f47fb3ee
commit
b46a3611af
7 files changed
+23
-11
No files matched your search
@@ -229,11 +229,11 @@ Remember section 12 of Module 7: the loop only helps if each continuation does a
|
||||
That's the whole runtime. Go back to the stateful code at the start of Module 8, with its `let state` and logic in callbacks, and compare. There, the mutable variable held the *game state*, and game logic lived in the callbacks. Here, the variable holds the *current stream* — the runtime doesn't even know there's a game. It has no idea what a snake, a tick or a score is. All the game logic is in pure values; the runtime is a few lines of plumbing. That is what "pushing effects to the edge" means in practice.
|
||||
|
||||
```
|
||||
┌──────────────────────── runtime (impure, ~20 lines) ─────────────────────────┐
|
||||
browser ──key──▶│ feed(KeyDown key): [ios, next] = stream.step(ev); stream = next; ios.forEach(runIO) │──▶ canvas
|
||||
──time─▶│ feed(Time t) │
|
||||
└───────────────────────────────────────────────────────────────────────────────┘
|
||||
▲ the one `let` / `var` / ref cell: stream
|
||||
┌────────────────────────────── runtime (impure, ~20 lines) ─────────────────────────────────┐
|
||||
browser ──key──▶│ feed(KeyDown key): [ios, next] = stream.step(ev); stream = next; ios.forEach(runIO) │
|
||||
──time─▶│ feed(Time t) │
|
||||
└────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
▲ the one `let` / `var` / ref cell: stream
|
||||
```
|
||||
|
||||
The tests describe the behaviour precisely; read them before writing the code:
|
||||
|
||||
Reference in new issue
Block a user