Re: DISFAVORED Was: name for 3 PICK finally?
- From: Bruce McFarling <agila61@xxxxxxxxxxxx>
- Date: Fri, 7 Mar 2008 16:06:19 -0800 (PST)
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.
.
- Follow-Ups:
- Re: DISFAVORED Was: name for 3 PICK finally?
- From: Mark W. Humphries
- Re: DISFAVORED Was: name for 3 PICK finally?
- From: Jonah Thomas
- Re: DISFAVORED Was: name for 3 PICK finally?
- References:
- name for 3 PICK finally?
- From: m_l_g3
- Re: name for 3 PICK finally?
- From: m_l_g3
- Re: name for 3 PICK finally?
- From: Andrew Haley
- Re: name for 3 PICK finally?
- From: Coos Haak
- Re: name for 3 PICK finally?
- From: Jerry Avins
- Re: name for 3 PICK finally?
- From: Jonah Thomas
- Re: name for 3 PICK finally?
- From: Andrew Haley
- Re: name for 3 PICK finally?
- From: Jonah Thomas
- Re: name for 3 PICK finally?
- From: Andrew Haley
- DISFAVORED Was: name for 3 PICK finally?
- From: Jonah Thomas
- Re: DISFAVORED Was: name for 3 PICK finally?
- From: Andrew Haley
- Re: DISFAVORED Was: name for 3 PICK finally?
- From: Jonah Thomas
- Re: DISFAVORED Was: name for 3 PICK finally?
- From: Bruce McFarling
- Re: DISFAVORED Was: name for 3 PICK finally?
- From: Jonah Thomas
- Re: DISFAVORED Was: name for 3 PICK finally?
- From: Bruce McFarling
- Re: DISFAVORED Was: name for 3 PICK finally?
- From: Jonah Thomas
- name for 3 PICK finally?
- Prev by Date: Re: DISFAVORED Was: name for 3 PICK finally?
- Next by Date: Re: part 21 asserts forth best for small memory systems, would lisp be better in non small mem?
- Previous by thread: Re: DISFAVORED Was: name for 3 PICK finally?
- Next by thread: Re: DISFAVORED Was: name for 3 PICK finally?
- Index(es):
Relevant Pages
|