Sujet : Re: ADDRESSABLE: value-flavoured words
De : ruvim.pinka (at) *nospam* gmail.com (Ruvim)
Groupes : comp.lang.forthDate : 14. May 2025, 08:04:00
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <1001f91$2b9mr$1@dont-email.me>
References : 1 2 3
User-Agent : Mozilla Thunderbird
On 2025-05-14 01:32, Anton Ertl wrote:
Ruvim <ruvim.pinka@gmail.com> writes:
Why does this name end with a colon?
Just `addressable` (without a colon) looks better.
Inside a locals definition {: ... :}, names ending in ":" are
reserved. So, to avoid potential conflicts with existing names in
existing standard code, the word used inside {: ... :} ends in a
colon. And consequently, the word using outside {: ... :} ends in a
colon, too.
Punctuation marks looks special so each of them (if used) should have its own special meaning in naming conventions. If one of two similar words ends in a colon, and another does not — it looks very strange.
For example: `field:` and `+field` or `buffer:` and `constant`.
The argument "we already have a standard word `buffer`" does not justify us, moreover, this circumstance makes further aggravates the situation.
The argument about locals declaration syntax does not justify inconsistency in Forth words naming either.
`{: :}` is a special syntax, and the components it contains are not Forth words. In this syntax, lexemes that consist of a single non-alphabetic character are also reserved. It's better to choose one of them to indicate an addressable local variable. For example `&`.
This looks better (or at least more concise):
: foo {: & x & y z :} ... ;
than this:
: foo {: addressable: x addressable: y z :} ... ;
But I would prefer something like this:
: foo {: &x &y z :} ... ;
And the name `addressable` is certainly better than `addressable:` in Gforth.
: bar {: addressable: x -- y :}
5 addr x +! x ;
>
>
This declaration of `x` does not look good regardless of the colon.
I hope this makes you think twice about whether you really need an
addressable value-flavoured local.
In my programs I try to avoid any non-standard means as much as possible.
-- Ruvim