larsbrinkhoff / lbForth

Self-hosting metacompiled Forth, bootstrapping from a few lines of C; targets Linux, Windows, ARM, RISC-V, 68000, PDP-11, asm.js.
GNU General Public License v3.0
418 stars 112 forks source link

Exceptions don't work well with the SEARCH wordset #20

Open larsbrinkhoff opened 8 years ago

larsbrinkhoff commented 8 years ago

When an exception is thrown, one wordlist is dropped from the search order.

Test case:

include search.fth
also forth order \ "forth forth only"
abort
order \ "forth only"
vonbrand commented 6 years ago

This is due to an uncaught THROW. No clean solution yet here... need to have a catchall CATCH in the outer loop and fix up some other pieces.

larsbrinkhoff commented 6 years ago

Thanks. It's actually because [ and ] calls PREVIOUS and ALSO. The intent is that ] adds compiler-words to the search order, and [ removes it. And ABORT calls [ to enter interpret mode.

Without search.fth loaded PREVIOUS and ALSO are no-ops. But when loaded, those words are redefined to use the search order stack. And it becomes unbalanced when ABORT is called.