Sujet : Re: portable or not? Volatile strings
De : ruvim.pinka (at) *nospam* gmail.com (Ruvim)
Groupes : comp.lang.forthDate : 12. Aug 2024, 12:27:54
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v9crjs$364en$5@dont-email.me>
References : 1 2 3
User-Agent : Mozilla Thunderbird
On 2024-08-12 13:31,
albert@spenarnc.xs4all.nl wrote:
In article <v9ch3d$364en$2@dont-email.me>,
Ruvim <ruvim.pinka@gmail.com> wrote:
On 2024-08-11 17:35, albert@spenarnc.xs4all.nl wrote:
[...]
I made S" " such that it ALLOT's the string at HERE,
>
This is not allowed, without any options.
>
The alloted data space regions shall be contiguous unless "definitions
are added to or removed from the dictionary between allocations"
(3.3.3.2), or the function of `INCLUDED` is performed (11.6.1.1718,
11.6.2.1714). No other conditions are mentioned anywhere.
That settles it. Note that it applies to interpret mode only,
during a definition being permanent is not an issue because it is in a
definition.
This is a defect ("bug") in S" in ciforth.
The only solution is to make S" state smart:
: S" STATE @ IF POSTPONE " ELSE &" PARSE ; IMMEDIATE
This implementation implies an environmental restriction: the string returned by the interpretation semantics of `S"` is valid until a subsequent invocation of `REFILL`, because the returned string is located in the input buffer.
[ Before it was an alias for the "-as-a-prefix without the
prefix flag.
: S" POSTPONE " ; IMMEDIATE
In this implementation the interpretation semantics are incorrect, right?
It sticks to the design rule for ciforth that only denotations,
generalisation of numbers, are allowed to be state smart. ]
-- Ruvim