Sujet : Re: How robust is INCLUDE
De : ruvim.pinka (at) *nospam* gmail.com (Ruvim)
Groupes : comp.lang.forthDate : 29. Jan 2025, 00:00:04
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vnbnhj$20ov7$2@dont-email.me>
References : 1
User-Agent : Mozilla Thunderbird
On 2024-12-19 19:22, mhx wrote:
I wonder if the following code is (partially) ANS compatible,
[...]
\ in file inside1.frt
\ ] CR DUP . R@ . S . one . two . three . one two * three * DUP TO
result [
: MAIN1 ( -- )
1 2 3 0 LOCALS| result three two one |
4 >S 5 >R 6
[ S" inside1.frt" INCLUDED ] ( at compile time, locals accessible )
Such loading of a file has an environmental dependency.
11.6.1.1718:
| INCLUDED may allocate memory in data space
| before it starts interpreting the file.
If it does such allocating, and if code space interlaces with data space, your loading of a definition fragment will not work.
Another possible problem is accessing locals when you place data on the return stack. This also introduces an environmental dependency.
13.3.3.2, d:
| After a definition's locals have been declared,
| a program may place data on the return stack. However,
| if this is done, locals shall not be accessed until
| those values have been removed from the return stack;
-- Ruvim