Library: define named slots in bulk #141
ruv
started this conversation in
Show and tell
Replies: 1 comment
-
Now a syntax to set several slots at once, like It works in interpretation state as well as in compilation state:
And it's implemented in a single word of
BTW, this example also shows that the dual-xt (or dual-nt) approach doesn't provide any usefulness for such cases. It only requires more bloated code without any profit. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
By a slot I mean a memory location reserved for some data type, and for which the getter and setter words are defined.
Many years I use slots instead of VALUEs and DEFERs. A one difference is that you have separate individual words to set (or get) a value instead of use the special words like
to
,is
, oraction-of
. And a second useful thing is that you can create a number of slots at once.One advantage of setters is that a setter can be easily redefined/wrapped, but a word for which "TO name run-time" semantics are defined cannot be redefined.
In my case, the slots were defined in ForthML — which is an XML-based representation/syntax for Forth.
Now I have prepared a library in standard Forth.
Usage example:
When a slot definition is used inside a definition, creating of slots is postponed.
Feedback is welcome.
Beta Was this translation helpful? Give feedback.
All reactions