From 4d9ef994097166a21febb181682c73985089eddd Mon Sep 17 00:00:00 2001 From: kitty Date: Mon, 23 Mar 2026 01:55:15 +1100 Subject: create does> constant seems to work just fine. wonderful! i don't think the speed should be that much worse but if it ends up being slow i can manually make a faster `constant`. --- sanctuary.fs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sanctuary.fs') diff --git a/sanctuary.fs b/sanctuary.fs index b0867d1..eea702f 100644 --- a/sanctuary.fs +++ b/sanctuary.fs @@ -32,7 +32,11 @@ : postpone 'h ( word ) dup immediate? if >body compile, else >body [compile] literal ['] compile, compile, then ; immediate -\ my plan is that (CREATE) is followed by a dummy zero cell -\ which (DOES>) uses. waste of 8 bytes but it's simpler : create parse-name (header) latest ! ['] (create) compile, 0 , ; +: does> latest @ >body 2 + ['] (does>) over ! \ replace call loc + ( replace destination ) 11 + r> swap ! ; + ( the lone r> means we don't execute the rest of the word now, ) + ( but it is actually compiled into the definition and is jumped to ) + ( by a create does> made word ) +: constant create , does> @ ; bye -- cgit v1.2.3