J Thomas
2006-08-28 14:24:24 UTC
I don't have a proposal thought out, only some beginning ideas. Anybody
is welcome to build on them for whatever purpose, or to criticise them.
Usually what we need is not IMMEDIATE words or state-smart words.
IMMEDIATE was a quick simple hack that people have been working around
for 30 years. It's usually adequate, but not good.
Any word that includes POSTPONE or executes COMPILE, (or [COMPILE] ?)
is compile-only, and recursively any word that executes a word that
includes POSTPONE etc it compile-only.
The complications of state-smart etc don't belong in the words
themselves. The issue doesn't come up after you execute the words. The
issue comes up in the interpreter/compiler, when you FIND words and
decide what to do with them.
What if FIND (or its string-and-count replacement) were to give more
information? What if it were to give
-3 normal compilation behavior, do not interpret.
-2 discard the xt always, do nothing.
-1 execute when interpreting, compile when compiling.
0 not found
1 immediate
2 do not interpret, execute while compiling
3. execute while compiling, do not execute while interpreting, but a
second xt is available to execute while interpreting or fetch with '
['] etc. The other xt can be found with a special command.
Wouldn't a lot of the endless complications go away if this extra
information was available to standard programs?
Whenever you POSTPONE a word or compile COMPILE, the current word
becomes type -3 unless it already has compiled : or :NONAME or
postponed DOES> , and if you try to make it immediate it becomes type
2. The rules for that might turn out to be too complicated to use, but
some of them might give useful warning messages without getting too
much in the way.
Wordlists don't clean up the IMMEDIATE mess, they make more messes
attempting to solve that. IMMEDIATE affects FIND . State-smart words
don't work because they try to fix something that ought to happen while
parsing with something that happens at execution time -- whenever
execution happens. An improved FIND and more sophisticated behaviors at
that point might do it.
is welcome to build on them for whatever purpose, or to criticise them.
Usually what we need is not IMMEDIATE words or state-smart words.
IMMEDIATE was a quick simple hack that people have been working around
for 30 years. It's usually adequate, but not good.
Any word that includes POSTPONE or executes COMPILE, (or [COMPILE] ?)
is compile-only, and recursively any word that executes a word that
includes POSTPONE etc it compile-only.
The complications of state-smart etc don't belong in the words
themselves. The issue doesn't come up after you execute the words. The
issue comes up in the interpreter/compiler, when you FIND words and
decide what to do with them.
What if FIND (or its string-and-count replacement) were to give more
information? What if it were to give
-3 normal compilation behavior, do not interpret.
-2 discard the xt always, do nothing.
-1 execute when interpreting, compile when compiling.
0 not found
1 immediate
2 do not interpret, execute while compiling
3. execute while compiling, do not execute while interpreting, but a
second xt is available to execute while interpreting or fetch with '
['] etc. The other xt can be found with a special command.
Wouldn't a lot of the endless complications go away if this extra
information was available to standard programs?
Whenever you POSTPONE a word or compile COMPILE, the current word
becomes type -3 unless it already has compiled : or :NONAME or
postponed DOES> , and if you try to make it immediate it becomes type
2. The rules for that might turn out to be too complicated to use, but
some of them might give useful warning messages without getting too
much in the way.
Wordlists don't clean up the IMMEDIATE mess, they make more messes
attempting to solve that. IMMEDIATE affects FIND . State-smart words
don't work because they try to fix something that ought to happen while
parsing with something that happens at execution time -- whenever
execution happens. An improved FIND and more sophisticated behaviors at
that point might do it.