Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem of unknown words in the search order #9

Open
ruv opened this issue Jun 11, 2020 · 0 comments
Open

Problem of unknown words in the search order #9

ruv opened this issue Jun 11, 2020 · 0 comments
Labels
epic multilevel, multiway, deep, complex problem v4-review Related to the proposal v4 by Matthias Trute

Comments

@ruv
Copy link
Collaborator

ruv commented Jun 11, 2020

Problem

Let's consider some use case for the quote recognizer recognize-word-quoted, that allows to get the xt of a word using the syntax like 'X.

' recognize-word-quoted set-perceptor-after

\ use this feature
: x [...] ;
: foo 'x [...] ;

unset-perceptor

Can we face any problem with that? Yes, we can. If the forth-wordlist contains a word 'x , our lexeme "'x" will be resolved into this word and our recognize-word-quoted will not get control, and we will get unexpected binding.

So, the only solution is to set our recognizer before other:

' recognize-word-quoted set-perceptor-before
[...]
unset-perceptor

NB: Recognizer v4 API does not guarantee that a user-defined recognizer can get control before the system's recognizer of Forth words.

On the other hand, recognize-word-quoted (or any other) cannot be set before the recognizer of the Forth words in the default perceptor — for the sake of backward compatibility.

Actually, we already have this problem with numbers and characters ('c' syntax). But usually the default search order does not contains names that conflict with these syntaxes. Nevertheless, nothing may prevent a Forth system to have such words, — and it will not make the Forth system non-standard (at the moment).

Conclusion and ideas

1. The standard should be tighter regarding the default search order and the words that it may contain.

2. Perhaps, in addition to the "standard program" notion, the "standard module" notion should be introduced.

3. A module may grant only limited scopes to additional recognizers.

4. Perhaps some level of sand-boxing can be implemented to load third party library modules. Another approach is to just automatically revert the perceptor, the search order, the base, etc., after loading a module.

@ruv ruv added the v4-review Related to the proposal v4 by Matthias Trute label Jun 12, 2020
@ruv ruv added the epic multilevel, multiway, deep, complex problem label Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic multilevel, multiway, deep, complex problem v4-review Related to the proposal v4 by Matthias Trute
Projects
None yet
Development

No branches or pull requests

1 participant