Re: DISFAVORED Was: name for 3 PICK finally?



On Mar 7, 6:15 pm, Jonah Thomas <jethom...@xxxxxxxxx> wrote:
I don't want to argue that it's important. But it was an obvious example
of someyhing you lose if you give up POSTPONE [COMPILE] etc. If you have
to parse a string and do dictionary lookups every time you use the
macro, that's less efficient than doing all that once and then just
laying down the code at the macro's runtime. Less efficient. And if for
some reason you want to compile code when the dictionary is unavailable,
POSTPONE lets you do it and macros don't let you. I don't yet see a
third disadvantage.

I don't follow the distinction here between "macro" on one hand and
"POSTPONE" on the other hand ... "POSTPONE lets you / macros don't let
you".

The thing that POSTPONE supports automatically that an early bound
macro would have to go to more trouble to support is state
dependence ... making a decision of what to compile based on a test at
the time of compilation.

But clearly, if the macro building word is early-bound, it doesn't
require string parsing and dictionary look-ups when it executes. So it
seems like you are making late-bound macros into the only kind of
macros that exist.

I normally write compiler macros using POSTPONE, and that's the only
thing I use POSTPONE for. If an early-bound macro compiler was built
into the implementation, I could relegate POSTPONE to a Forth-94
portability harness.

After all, as already described, [:] ... [;] is early bound, not late
bound:

[:] >>R ( executes: x -- x R: x ) DUP >R [;]

is the equivalent of:

: >>R ( executes: x -- x R: x ) POSTPONE DUP POSTPONE >R ; IMMEDIATE

not the equivalent of:

: >>R ( executes: x -- x R: x ) S" DUP >R" EVALUATE ; IMMEDIATE

.... and if I had ``[:] ... [;]'' built in, I wouldn't need POSTPONE.

It seems to me that what you are describing above is not "compiling
without using the dictionary" but rather factoring out the use of the
dictionary from the process of compiling. The dictionary is required
for the process, but not for each step in the process.

My initial reaction was, "but, what are you going to do, refer to the
words by remembering their index entry in a vector", but if its
genetic programming with algorithmic selection of the operation based
on tabulated results from a previous iteration, referring to words
based on an index value makes sense.
.



Relevant Pages

  • Re: Compile time string literal substitution to external data file
    ... and these string literals may expose sensitive information ... > I want to use the compile time macros for file name, line number, and ... I'd put a macro and a function like: ...
    (microsoft.public.vc.language)
  • Re: Rebuilding functions at run-time
    ... (deftemplate foo () ... But, AFAIK, this can't be a macro, since it will be expanded at macro- ... Another option could be compile, ... (let ((string initial-string)) ...
    (comp.lang.lisp)
  • BB4WFORTH - Making it more compatible....
    ... As you may know BB4WFORTH is a FORTH which is originally based on ... When the interpreter runs out of data (i.e>IN is greater than the ... COMPILE, and POSTPONE is where I got stuck, because I'm not ...
    (comp.lang.forth)
  • Re: RfD -- FVALUE vsn 2.0
    ... if the result of a word is a compile time constant, ... But if you try to make a state-smart word that is supposed to duplicate ... POSTPONE or EXECUTE etc will go wrong. ... Suppose you want a state-smart DUP that will imitate the usual DUP. ...
    (comp.lang.forth)
  • Re: BB4WFORTH - Making it more compatible....
    ... but using the string found ... When the interpreter runs out of data (i.e>IN is greater than the ... COMPILE, and POSTPONE are usually used by the system for constructing basic definitions. ...
    (comp.lang.forth)