mitra42 / webForth

Forth for the web - implemented in JS and other web technologies
https://www.mitra.biz/forth/console.html
GNU Affero General Public License v3.0
27 stars 1 forks source link

Exceptions failing hayes test #106

Open mitra42 opened 11 months ago

mitra42 commented 11 months ago

Exceptions should be working, but fail the Hayes tests (see issue #83) S" exceptiontest.fth" INCLUDED TESTING CATCH THROW TESTING ABORT ABORT"

WRONG NUMBER OF RESULTS: T{ 1 2 ' T6 C6 -> 1 2 11 }T \ Test that ABORT is caught WRONG NUMBER OF RESULTS: T{ 4 5 ' T10 C6 -> 4 77 12 }T \ ABORT" caught, no messageTESTING a system generated exception

333 $$QWEQWEQWERT$$ 334 ^^^^^^^^^^^^^^^^^^^^ $$QWEQWEQWERT$$ ? ok ok ok ok

mitra42 commented 11 months ago

Fixed ABORT - now returns -1 instead of pointer to NULL$ ABORT" is harder (abort") uses do$ to get string (approx line 1164), but passes it to THROW (approx line 965) If we pass -2 it will be (correctly) passed to the line after the CATCH BUT if there is no CATCH (i.e. ABORT" used outside of a CATCH), it is supposed to print an error , and we don't have a way of finding that error from inside the THROW or the CATCH since we've replaced the string address with -2| For now we've stuck with returning an error string address from ABORT"

https://forth-standard.org/standard/core/ABORTq says ABORT" should display the message https://forth-standard.org/standard/exception/ABORTq says should only display if no handler https://forth-standard.org/standard/exception/THROW gives a standard, but erroneous, definition (Comment made, but doesn't look like they ever make it through to the text, as I posted a bug on another problem in this word three years ago which was accepted but the text never changed).