Sujet : Re: 0 SET-ORDER why?
De : the.beez.speaks (at) *nospam* gmail.com (Hans Bezemer)
Groupes : comp.lang.forthDate : 28. Jun 2024, 17:39:03
Autres entêtes
Organisation : KPN B.V.
Message-ID : <nnd$0542b810$2ece0e61@915d86f03c2448ce>
References : 1 2 3 4
User-Agent : Mozilla Thunderbird
On 28-06-2024 17:50, Anton Ertl wrote:
Krishna Myneni <krishna.myneni@ccreweb.org> writes:
On 6/26/24 02:49, Anton Ertl wrote:
Krishna Myneni <krishna.myneni@ccreweb.org> writes:
Why is 0 a valid argument to SET-ORDER (from the optional Search-Order
word set)? It can leave a Forth system in a non-recoverable state.
>
So what? There are lots of ways to put a Forth system in a
non-recoverable state.
...
>
By design? No.
Does it matter?
If the user accidentially puts the Forth system in a non-recoverable
state, there is no difference between "by design" (e.g., 0 SET-ORDER)
and "by doing non-standard things".
If the user intentionally puts the Forth system in a non-recoverable
state (e.g.,
<https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Crash-Course-Tutorial.html>),
it does not matter, either.
- anton
Interesting challenge! 4tH supports all these words, so I should at least be able to compile it. But no:
4tH message: Undefined name at word 5
It cannot compile, because CATCH isn't *defined* - it's a builtin. It has no address to point to. So I change it slightly:
: (catch) catch ;
: (quit) quit ;
0 0 !
here execute
' (catch) >body 20 erase abort
' (quit) >body 20 erase
And yes, it compiles cleanly. However, when executing:
Executing; Word 9: Bad variable
Because you're not allowed to anything write at that address. You can read it though. Let's remove it..
Executing; Word 8: Stack empty
Yeah, EXECUTE requires an execution token. The stack is empty.
If we skip that one too, it runs! That is because "10" and "14" are addresses in the 256 byte TIB, which is located in the Character Segment. That's where ERASE does its job.
So that's harmless..
That was fun!
Hans Bezemer