[comp.lang.forth] Problems with ALSO/ONLY

wmb@MITCH.ENG.SUN.COM (02/15/91)

Disclaimer: I don't dislike ALSO/ONLY; I use them every day.  But they
do have some problems:

1) There is no standard way to save the existing search order, set the
   search order to a particular value, and later restore the search order.

2) In the common implementations, it is easy to get in a situation where
   the same vocabulary is searched twice.  This is an implementation problem,
   not a specification problem, and it's only bad effect is slower compilation,
   but some people criticise it anyway.

3) A program has no standard way of knowing how many vocabularies it can
   add to the search order before the search order data structure overflows
   and the system crashes.

4) Many people think that the behavior of the search order as a "funny stack"
   (where the execution of a vocabulary *replaces* the top of the stack) is
   screwy.

5) There is no portable way of testing what is in the search order.

6) There is no portable way of removing a particular vocabulary from the
   search order.

Basically, with ALSO/ONLY as described in Forth 83 (as an experimental
wordset), you could set the search order to a particular value, but that
is all.  Anything else that you wanted to do required knowledge of exactly
how it was implemented.

I would be interested to hear of other problems that I may have missed.

Mitch Bradley, wmb@Eng.Sun.COM

yoshi@nocusuhs.nnmc.navy.mil (Dojun Yoshikami) (03/05/91)

In article <9102151422.AA01056@ucbvax.Berkeley.EDU> wmb%MITCH.ENG.SUN.COM@SCFVM.GSFC.NASA.GOV writes:
>Disclaimer: I don't dislike ALSO/ONLY; I use them every day.  But they
>do have some problems:
>
> [lines deleted]

I found that the Also/Only mechanism is misleading regarding its true actions.
We wound up redefining ALSO so that the words behave more like words on
a stack.  For instance, to put somehting on the return stack is >R , so
logically to put something on the "Vocabulary" stack would be >V.
We also add the words VDUP, VDROP, V@, V>, for the same reason.  Conceptaully
this is much nicer, as it gives the Forthwright some idea regarding
the vocabulary stack's behavior.  One of the suggestions was to write this
up as a proposal for the ANSI Forth, but none of us have the time.  What
do you think of it?

DY 

=-=-=-=-=-=-=-=-=-=-=-=-=-=+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
D M Yoshikami  :-) ;-) :-) | Internet: yoshikami@usuhsb.ucc.usuhs.nnmc.navy.mil
May the Forth be with you! | Bitnet  : yoshikami@usuhsb.bitnet
***  !!xob X*NU V METSYS T&TA eht ni renosirp dleh gnieb m`I  !pleH  !pleH  ***
=-=-=-=-=-=-=-=-=-=-=-=-=-=+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=