I am using Gforth and I want to create a word in a definition. On the cmd Gforth line, I can type:
create foo
ok
Or, more specifically, I defined an array function that expects a size on the stack and creates a word with an address in this array:
: array ( n
create cells allot
does> cells + ;
So, if I type 10 array foo, I can use foolater.
But if I wrote 10 array fooas part of another definition, he gave me a compilation error. I tried replacing foo with s" foo"one that compiles, but it explodes at runtime, saying:
Trying to use a zero-length string as a name
Is there any way to do this?
source
share