aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/common/lib/quotations.frt
diff options
context:
space:
mode:
Diffstat (limited to 'amforth-6.5/common/lib/quotations.frt')
-rw-r--r--amforth-6.5/common/lib/quotations.frt26
1 files changed, 26 insertions, 0 deletions
diff --git a/amforth-6.5/common/lib/quotations.frt b/amforth-6.5/common/lib/quotations.frt
new file mode 100644
index 0000000..7f7659b
--- /dev/null
+++ b/amforth-6.5/common/lib/quotations.frt
@@ -0,0 +1,26 @@
+\ anonymous definitions in a definition
+\ typical usage
+\ : foo ... [: some words ;] ... ;
+\
+\ is equivalent to
+\
+\ :noname some words ; Constant #temp#
+\ : foo ... #temp# ... ;
+\
+\ #require 2-fetch.frt
+\ #require 2-store.frt
+
+: [: ( -- quotation-sys )
+ postpone ahead
+ latest @ newest 2@ \ save definition state
+ :noname \ defines quotation-sys as ( -- latest newest XT ) ( 4 cells)
+; immediate
+
+: ;] ( compile-time: quotation-sys -- ; run-time: -- xt )
+ postpone ; >r
+ newest 2! latest ! \ restore definiion state
+ postpone then
+ r>
+ postpone literal
+ ]
+; immediate