summaryrefslogtreecommitdiff
path: root/sanctuary.fs
diff options
context:
space:
mode:
authorkitty <nepeta@canaglie.net>2026-03-23 01:55:15 +1100
committerkitty <nepeta@canaglie.net>2026-03-23 01:55:15 +1100
commit4d9ef994097166a21febb181682c73985089eddd (patch)
tree4c0306f8251e770d40003dec0422d7a30607ccc1 /sanctuary.fs
parentccc5e9514111ecec8c045a9b78cb2052da090c95 (diff)
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`.
Diffstat (limited to 'sanctuary.fs')
-rw-r--r--sanctuary.fs8
1 files changed, 6 insertions, 2 deletions
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