As a user, I would prefer the tick-recognizer precedes the
word-recognizer. Since I know that I always use a leading tick either to
quoting a word, or for a character literal (when the lexeme ends with a
tick and consists of 3 xchars), and don't use a tick in names at all.
But another user, or the system implementer, who wants to use names
starting with tick (and probably doesn't use additional recognizers at
all), would prefer the word-recognizer precedes the tick-recognizer.
And only this latter option (where the word-recognizer is the most
precedence) is back compatible. The former option (where the
tick-recognizer precedes the word-recognizer) destandardizes some
standard programs, so it is not acceptable.
But with the backward-compatible option I cannot safely rely on the
tick-recognizer since I cannot be sure that 'QUIT always return xt of
QUIT. (1)
>
> We also would have preferred to use 'FOO for the xt of FOO, but to
> avoid these problems, we chose `.
[...]
> In any case, while some problems are less serious than others, all of
> these problems are avoided by using ` in the tick-recognizer, which is
> why we are using that.
Using a backtick, you don't avoid the problem (1), but only reduce the
chance of encountering this problem. Eventually, you either effectively
destandardize names starting with a backtick (except this name itself),
or make the backtick-recognizer unsafe (and so unusable).
I cannot rely on the backtick-recognizer at all, if I have even a little
chance that it returns not what I expect.
At the same time, many people in the Forth community will fairly resist
to any new restrictions on names.
Nota bene — this problem is a general problem for recognizers.
For example, if the implementer of a standard system, or some third
party library, provides a word "'M'" in the FORTH-WORDLIST, the system
is still standard (even having the included library).
And a standard program that uses a character literal 'M' is still a
standard program. But this standard program will work incorrectly on
this standard system, since the system will interpret "'M'" as its word
name.
So I see a declaration of a recognizer (that is the perceptor) as the
only solution of this general problem, and the problem (1) particularly.
It can be actually specified as an ordered sequence of recognizers, or a
single name of a well known sequence of recognizers.
Then, if I declare the used recognizers in any case, and it affects only
my code, and doesn't affect third-party code, why give up on the
preferred tick-recognizer?
>> I think we should find some conventions for these forms (and maybe some
>> other), and give them names. After that, to avoid conflicts, a Forth
>> source code file (or code block) that relies on a convention, should
>> start with a declaration that mentions the convention's name.
>>
>> The format of such a declaration probably should be standardized.
>>
>> As an example, JavaScript uses "use strict" string literal as the first
>> item of a code block to declare strict mode.
>>
>> We could use a list of recognizer names in the declaration. The scope of
>> this declaration (where this recognizers are in effect) should be
>> limited in obvious way.
>
> I think that, on the contrary, we should use one common set of words
> and syntax instead of introducing ways to declare idiosyncracy.
I don't interpret it as way to declare idiosyncrasy (although it can be
used for that). Otherwise any DSL, or even set of helping words that a
user includes into the search order would be declaration of idiosyncrasy.
I see it as a backward-compatible way to introduce a well-known set of
new features, that is connected with additional *restrictions* on
programs (that relies on these features).
I.e., for backward-compatibility, a handful of new words is better than
new *unconditional* restrictions on all word names.
> E.g., do I think that the alignment handling in struct.fs is superior
> to the Forth-2012 field words? Yes. Still, when writing new code, I
> use the Forth-2012 words. And that's despite the fact that struct.fs
> is a standard program, so you can use the struct.fs words fully
> portably. It's just that the cost of idiosyncrasy outweighs the
> benefits of the superior alignment handling.
I see. But now we are in the position as if the Forth-2012 field words
are not standardized yet. And we can choose a better set of words (and
their names).
> We have also had ways to specify which wordset a program uses: wordset
> queries with ENVIRONMENT?. A number of systems did not support that
> in a useful way, few programs used it, and eventually we decided to
> make them obsolescent (and refer only to Forth-94 while they are still
> there). So I expect that a new way to specify which dialect a program
> uses will also receive little love.
Don't you think the solution is not well designed for the problem?
The "ENVIRONMENT?" word just doesn't fit the problem of including
external libraries (external definitions for a word set).
Using "ENVIRONMENT?" a program should choose what to do if a word set is
missed. Usually a program chooses just to not work (not load, abort,
throw an error, etc).
But then why to use "ENVIRONMENT?", and analyze it results, if the
program will be aborted in any case, if a word is not found.
So this example doesn't support your position, I think.
> That being said, once we have standardized configurable recognizers,
> nothing prevents you from adding a recognizer that uses ' for xt
> literals and another recognizer that uses ` for string. So your
> convention might be something like
>
> require ruvim.4th ruvim-convention{
> ... \ code that uses ruvim-convention stuff
> }ruvim-convention
>
> I just hope that, like I do for field words, you will use the
> (hopefully standardized) string syntax "string" (which already has a
> lot of mindshare), and that we reach a consensus for a syntax for xt
> literals, and all use that then.
forth-2023 !perception{
... \ code that uses a standard set of recognizers
... \ including 'FOO `name wordlist1::wordlist2::name etc
... \ that precede the word-recognizer (!)
}
or
forth-2023 !perception// \ up to the end of file
(the naming is under construction)
--
Ruvim