State where a scalar lives in the three chapters that describe the pool
Chapter 13's limits table said 4096 array elements "in total", Chapter 16 said an instance's fields come out of the same pool and nothing is reclaimed, and Chapter 14's pool table listed `AKBASIC_MAX_ARRAY_VALUES` with no note about what does and does not draw from it. All three were written when a scalar drew from that pool, and all three now understate what a program may do. Each gains the same two facts in the register it is written in. Chapter 13: a scalar does not come out of the 4096, so creating one inside a `GOSUB` or a `FOR` -- the loop counter included -- costs nothing, while a `DIM` inside a scope does and is not given back. Chapter 16: scalars are the exception, and "nothing is reclaimed" is what lets a pointer into a record stay sound after its scope has gone -- which is the reason arrays and structures still spend. Chapter 14: a row for the variable's own storage, and a paragraph on why the value pool is the one budget that needs a second sentence. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -365,4 +365,7 @@ Three things a host should know:
|
||||
|
||||
An instance's fields come out of the same value pool arrays use, so the 4096-element
|
||||
budget in Chapter 13 covers both. **Nothing is reclaimed** — a structure lasts until
|
||||
`CLR` or `NEW`, exactly as an array does.
|
||||
`CLR` or `NEW`, exactly as an array does, and that is what lets a pointer into a record
|
||||
stay sound after the scope that declared it has gone. Scalars are the exception and are
|
||||
not in the pool at all; they live in the variable, so creating one inside a scope costs
|
||||
nothing.
|
||||
|
||||
Reference in New Issue
Block a user