pico8lisp icon indicating copy to clipboard operation
pico8lisp copied to clipboard

Error propagation in expressions

Open andrewguy9 opened this issue 4 years ago • 1 comments

Errors need to bubble up in expressions. (+ 1 'a) results in error not int a (= 1 (+ 1 'a)) results in ().

Expected: error....

andrewguy9 avatar Sep 06 '21 19:09 andrewguy9

I think that = is getting. (= 1 '(error ...)) which is a valid equality check.

PICO8 doesn't support throw, so we are returning errors not throwing.

Not sure what to do.

We could check for error lists in apply, and propagate there. But then it won't be easy to process errors. We could add our own abstraction for function call/return and rely less on LUA. We could change function semantics to return a (success, result) tuple. And treat non-success as a throw.

andrewguy9 avatar Sep 06 '21 19:09 andrewguy9