Loads turtle.4th and doe.4th, defines SDK-VERSION/SDK-HELP into an SDK vocabulary, then calls FENCE once everything is loaded -- protecting the base wordset and both cookbook capsules from FORGET. Kernel-only (EXEC doesn't exist hosted), REPL-invoked via S" sdk.4th" EXEC, not part of init.4th's boot sequence. Verified before writing the capsule, not assumed: VOCABULARY/DEFINITIONS does not actually scope word visibility in this interpreter -- vm_find_word is a flat dictionary scan that never consults CONTEXT/CURRENT. Documented plainly in the HOWTO so this isn't mistaken for namespace isolation later. Block range 5109-5115 -- discovered along the way that user-block space is capped at [2048, 5120) by mkcapsule, tighter than expected. Verified: mkcapsule --lint clean, hosted-build trace runs SDK-HELP with zero attributable VM errors, zero build warnings and identical 1012/0/0 POST results with matching dict_hash on all three kernel architectures. HOWTO: docs/working/architecture/SDK-HOWTO-20260819.md Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
61 lines
2.2 KiB
Forth
61 lines
2.2 KiB
Forth
Block 5109
|
|
( sdk.4th -- SDK v1.9.0 scoping. Loads the cookbook )
|
|
( capsules (turtle.4th, doe.4th), a discoverable SDK )
|
|
( vocabulary entry point, and raises FENCE once )
|
|
( everything is loaded, so a developer at the REPL can )
|
|
( FORGET their own scratch work afterward without )
|
|
( disturbing any of this. Kernel-only (EXEC is kernel- )
|
|
( only); REPL-invoked -- S" sdk.4th" EXEC -- not part of )
|
|
( init.4th's boot sequence, matching turtle.4th's own )
|
|
( choice. NOTE: VOCABULARY/DEFINITIONS here is )
|
|
( organizational, not isolating -- this VM's word lookup )
|
|
( is a flat dictionary scan, so SDK words remain )
|
|
( globally callable like any other word, both before and )
|
|
( after this capsule loads. Verified directly on the )
|
|
( hosted build before writing this file. )
|
|
VOCABULARY SDK
|
|
|
|
Block 5110
|
|
( Load the cookbook capsules this SDK re-exports. )
|
|
S" turtle.4th" EXEC
|
|
S" doe.4th" EXEC
|
|
|
|
Block 5111
|
|
( SDK's own words, defined into the SDK vocabulary for )
|
|
( introspection -- see the note above, they are just as )
|
|
( callable from FORTH context as anywhere else. )
|
|
SDK DEFINITIONS
|
|
|
|
: SDK-VERSION ( -- )
|
|
." SDK v1.9.0 (scoping)" CR ;
|
|
|
|
Block 5112
|
|
: SDK-HELP ( -- )
|
|
." SDK vocabulary: turtle.4th + doe.4th + FENCE." CR
|
|
." Turtle graphics (docs/working/architecture/" CR
|
|
." TURTLE-GRAPHICS-HOWTO-20260819.md):" CR
|
|
." HOME CS FORWARD BACK LEFT RIGHT PENUP PENDOWN" CR
|
|
." SETCOLOR SETXY SETHEADING POLYGON STAR TURTLE-DEMO" CR
|
|
|
|
Block 5113
|
|
." DoE library (docs/working/architecture/" CR
|
|
." DOE-LIBRARY-HOWTO-20260819.md):" CR
|
|
." DOE ( -- ) or seed n-reps EXEC-DOE" CR
|
|
." SDK-VERSION prints the release tag." CR ;
|
|
|
|
Block 5114
|
|
( Back to FORTH context -- CURRENT no longer targets )
|
|
( SDK, so anything typed at the REPL after this loads )
|
|
( defines normally. )
|
|
FORTH DEFINITIONS
|
|
|
|
Block 5115
|
|
( Raise FENCE now that the base wordset, turtle.4th, )
|
|
( doe.4th, and this file's own words are all loaded -- )
|
|
( a developer can FORGET their own later scratch )
|
|
( definitions without being able to reach back )
|
|
( through any of this. )
|
|
FENCE
|
|
SDK-VERSION
|
|
." Loaded. Run SDK-HELP for the word list." CR
|