Digest #240 2023-12-19

Contributions

[318] 2023-12-17 18:15:48 lmr wrote:

requestClarification - NDCS xt

When searching for a word with NDCS, what XT should be returned? An xt dependent on STATE at the time of the call as in the spec for FIND, a state-smart xt...? I'm surprised no one asked while FIND has lots of comments


[319] 2023-12-18 04:59:48 lmr wrote:

requestClarification - Nested invocation, ret stack

What assumptions can XT make about TWL and viceversa?

  • can XT invoke another TWL recursively?
  • can TWL save information on the return stack, e.g can I implement TWL using two nested DO loops (an inner one to iterate over wordlist indices, and a "dummy" outer one just to make wid available as J)?

Replies

[r1141] 2023-12-10 21:27:59 ruv replies:

comment - F.3 Seems in Error

Some tests in F.6.1.0140 +LOOP assume the radix is ten, and don't work in hexadecimal.

Namely:

T{ -20 31 -10 GD7 -> 31 21 11 1 -9 -19 6 }T
T{ -20 29 -10 GD7 -> 29 19 9 -1 -11 5 }T

And the tests that mention the number 256 (literally).


[r1142] 2023-12-18 08:43:16 AntonErtl replies:

requestClarification - NDCS xt

One interesting difference between FIND and SEARCH-WORDLIST is that FIND actually mentions that a different result can be returned depending on STATE while SEARCH-WORDLIST does not. Therefore Gforth always returns an xt representing the interpretation semantics (or an xt that throws -14 when executed if the word does not have interpretation semantics in Gforth). Nobody has complained about that yet, indicating that people probably don't search for words without interpretation semantics or words with non-default compilation semantics with SEARCH-WORDLIST.

There are ongoing discussions about topics involving semantics, xts and related topics, and they are unlikely to be resolved soon, so I doubt you will get a definite answer to your request soon.


[r1143] 2023-12-18 08:49:57 AntonErtl replies:

requestClarification - Nested invocation, ret stack

  • Yes, there is no stated restriction on what the xt passed to TRAVERSE-WORDLIST is allowed to do, so the xt is allowed to call TRAVERSE-WORDLIST.

  • Yes, in a standard system TRAVERSE-WORDLIST can use the return stack, because in a standard program words of which xts can be taken are not allowed to access return stack entries that they have not pushed on the return stack themselves.