Digest #299 2025-07-22

Contributions

[384] 2025-07-21 01:53:36 EricBlake wrote:

testcase - Typo in test

The test for IF and ELSE has this line twice

 T{ -1 GI1 -> 123 }T 

should the second one be

 T{ -1 GI2 -> 123 }T 

instead?


[385] 2025-07-21 02:57:44 EricBlake wrote:

testcase - Suggested test

It is possible to test AGAIN without an infinite loop if combined with the tools set AHEAD and CS-ROLL, as in:

: [1cs-roll] 1 CS-ROLL ; IMMEDIATE 
T{ : GI7 0 BEGIN (cs: -- d1 )
  111  ( first pass: -- 0 111 ; second pass: -- 0 111 444 111)
  OVER IF ( cs: -- d1 o2 )
    222 ( second pass only: -- 0 111 444 111 222 )
    AHEAD ( cs: -- d1 o2 o3 )
    [1cs-roll] ( cs: -- d1 o3 o2 )
    333 \ unreachable
  THEN ( cs: -- d1 o3 ) \ resolve the IF
   444 ( first pass only: -- 0 111 444 )
   [1cs-roll] ( cs: -- o3 d1 )
  AGAIN ( cs: -- o3 ) \ resolve the BEGIN
  555 \ unreachable
  THEN ( cs: -- ) \ resolve the AHEAD
  666 ( -- 0 111 444 111 222 666 )
; -> }T
T{ GI7 -> 0 111 444 111 222 666 }T

It would also be possible to test breaking a BEGIN-AGAIN loop with throw in the loop body, using the exception word set.

Replies

[r1454] 2025-07-20 12:02:55 AntonErtl replies:

requestClarification - What should the behavior be if the system has no hard-coded limit on size?

If you include unused, it has to provide the size of the remaining dictionary (here region) space. Returning the maxiumum unsigned value (what -1 becomes if you interpret it as unsigned) is probably wrong: unused allot should work.

Letting unused report less than might actually be allotable is not according to the specification, either, but I don't see how a standard program that uses unused would run into problems from that. At worst it uses less memory than would otherwise be available.

Finally, not implementing unused avoids the problem completely, but programs that use unused will not work out of the box. I don't think there are many such programs, however.


[r1455] 2025-07-21 13:54:29 EricBlake replies:

comment - F.3.18 typo

Other typos: F.3.1 has "unsinged" instead of "unsigned"; F.3.10 has "signes" instead of "signs". At this point, it is probably better to run a code spell-checker over the entire testsuite than to call out individual problems as I spot them.