Arrays in Forth

(forth.org)

26 points by tosh4 days ago

1 comments

  • eimrine57 minutes ago
    What are any inevitable use-cases of the unindexable array in Forth?
    • astrobe_22 minutes ago
      There&#x27;s none. It&#x27;s kind of like the &quot;hello world&quot; or &quot;empty program&quot; example for arrays.<p>What this page shows is that the CREATE ... DOES&gt; construct is similar to a closure, except it can only capture one address (or reference in languages that don&#x27;t want you to dirty your hands with addresses ;-) and it is always a global symbol (like almost always in Forth). It is still useful to encapsulate implementation details, though. Some people have said it is a basis for objects, which is a bit euphoric IMHO. You know, &quot;closures are the poor man&#x27;s objects, and objects are the poor man&#x27;s closures&quot;.
    • nine_k30 minutes ago
      An &quot;unindexed array&quot; is basically `char *` in C; the use cases are the same, I suppose.