Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

All the most common Forth I know implement CREATE DOES>

What’s funny, is that I used to know how it works, now any time I come across these kind of articles I get more and more confused and further away from understanding. It’s like reading those convoluted explanations of what a monad is.



It implements defining words ie. Additional compiler words.

It does this by doing something now, and later (you could read create does> as now later>)

So for

: CONSTANT CREATE , >DOES @ ;

This makes the defining word CONSTANT, which when run (now) compiles the next word

So CONSTANT myvar will compile myvar. Myvar, when run (later) will get it's value and push it to the datastack.


It only briefly goes into what it does, this article goes into how it's done for a particular implementation.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: