lbForth icon indicating copy to clipboard operation
lbForth copied to clipboard

Exceptions don't work well with the SEARCH wordset

Open larsbrinkhoff opened this issue 9 years ago • 2 comments

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"

larsbrinkhoff avatar Dec 29 '15 08:12 larsbrinkhoff

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.

vonbrand avatar Apr 06 '18 18:04 vonbrand

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.

larsbrinkhoff avatar Apr 06 '18 19:04 larsbrinkhoff