,---------------. | Contributions | `---------------´ ,------------------------------------------ | 2020-04-10 23:20:57 rrt wrote: | requestClarification - Reference implementation does not seem to cope with changes to the stack | see: https://forth-standard.org/standard/tools/BracketELSE#contribution-134 `------------------------------------------ I just noticed, having used the reference implementation of [IF]/[ELSE]/[THEN] in my own Forth system, that it keeps markers on the data stack, and hence does not work correctly if you write e.g. `1 [IF] 2 [ELSE] 3 [THEN]`. I have stared at the standard text, and it does not seem to forbid this usage; also I see that e.g. GForth makes use of `[IF]...[ELSE]....[THEN]` to put values on the stack in exactly this way (and GForth has its own rather different implementation. Assuming I've not misunderstood something here, could a warning about this limitation be added to the reference implementation until such time as it is improved? ,---------. | Replies | `---------´ ,------------------------------------------ | 2020-04-04 15:40:24 ikysil replies: | referenceImplementation - Suggested reference implementation | see: https://forth-standard.org/standard/core/FILL#reply-362 `------------------------------------------ Implementation with `BEGIN` leaves `c-addr u` on the stack. Corrected version: ``` : FILL ( c-addr u char -- ) ( If u is greater than zero, store char in each of u consecutive characters of memory beginning at c-addr.) >R BEGIN DUP 0<> WHILE OVER R@ SWAP C! 1 /STRING REPEAT 2DROP R> DROP ; ``` ,------------------------------------------ | 2020-04-11 10:20:02 rrt replies: | requestClarification - Reference implementation does not seem to cope with changes to the stack | see: https://forth-standard.org/standard/tools/BracketELSE#reply-363 `------------------------------------------ This is my misreading, and an unfortunate combination of circumstances in my own code that caused me to leap to this conclusion. So please delete my previous query!