Yes, combining the recognizer and wordlist search order looks
attractive, but the problem is existing uses of SET-ORDER ONLY etc.
If the programmer has written, say
forth-wordlist 1 set-order
should SET-ORDER add the integer recognizer, or integer and FP
recognizers or more recognizers? Likewise, GET-ORDER should not
return the default recognizers, but would return any additional
recognizers. With the recognizer order as separate entity, SET-ORDER
does not affect the active recognizers, and GET-ORDER does not see
them.
Hooking into FIND seemed like the logical thing to do for my
"temporary word" approach: FIND would then return the xt of the
temporary word, and FIND-NAME the nt. For the current, more practical
proposal, hooking into FIND cannot work, because the additional data
is passed on the stack, so the stack effect would be wrong (and
stashing the data in some fixed buffer does not cut it, either).
But even for the "temporary word" approach, hooking it into FIND is
not a good idea, as pointed out by Bernd Paysan: FIND is used in
existing user-defined interpreters, and these may not be prepared to
have additional recognizers active.
>I'm not so sure; phrases like
>
>get-recognizers ’ single-recognizer -rot 1+ set-recognizers
>
>are not paricularly clear without some form of explanation. Support
>words would be useful.
The idea here is probably that GET-ORDER and SET-ORDER are standard
already, and to provide an interface that parallels this interface.
As for convenience words, not even >ORDER has been proposed, and I
expect changes to the search order to be more frequent than changes to
the recognizer order.
That being said, maybe GET-ORDER/SET-ORDER is not so good that we
should make it the model for further interfaces.
Lately I lean towards an interface where we can construct a recognizer
as a sequence of other recognizers in the dictionary, e.g., as follows:
\ we have a recognizer STANDARD-RECOGNIZERS
rec-seq my-recognizers
' standard-recognizers ,
' angle-recognizer ,
end-seq
' my-recognizers is forth-recognizer
... do something with angles ...
' standard-recognizers is forth-recognizer
>7. FORTH-RECOGNIZER
>
>Having this as a value to allow multiple recognizer stacks is debatable.
>We don't have a way of specifying multiple search order stacks.
With the GET/SET interface, we don't need that, true. With an
interface like the one above, we would need it.
>The whole area of search orders and recognizer stacks is much messier
>than I think it need be. A uniform stack & some way of managing it is
>imho required, but it might make the proposal a larger and more
>fundamental change than the community is willing to support.
I don't think it's particularly messy. It's just that there are a
buch of options, each with something to be said for them. If we want
to think them all through and find the best one, you end up in a mess.
But given that there has been no strong movement to replace
GET-ORDER/SET-ORDER with something more convenient, maybe a suboptimal
solution is not a big problem. So let's just go with the one that the
proponent decides on.