I outfitted `rest` with some error reporting and tried out exception
handling. So far so good.
One issue is that the dictionary is not a persistent datastructure, so
if there was an "inscribe" command (it's not yet implemented for this
Scheme implementation) that might be slightly problematical. (If an
error were to occur in an evaluation that had already entered new
definitions into the dict then those definitions would "survive" into
the rest of the REPL session (or whatever.))
I'll look into persistent dict for Scheme.
This shouldn't work yet, because the parser makes Lisp symbols out of
the Thun symbols, but the match expr still has strings. In the REPL
this fails, but in the compiled Joy binary it doesn't fail, the
interpreter interprets just fine.
This went pretty smoothly, I just followed the compiler errors after
substituting Integer for Int in the type definition.
The only tricky thing is that the div and mod functions for Integer
return Maybe Integer rather than just Integer, so I need to wrap those
or something? (For now I just put in add to get it to compile.)
Oh, and "not equal" is not correct? The compiler didn't complain.
Not all of the words that compiled with the old defs.txt compiled with
the latest, so we're keeping the old one in here until I can trace down
the issues.
What if we insist that both branches of a branch have compatible types?
For one thing `[+] [* +] branch` leads to a circular term which, when
printed, goes into a loop: "int,int,int,...". Hmm...
I know there are better ways to do this, but I don't know what they are
yet. Maybe a "do" loop? Anyway, this works, although it doesn't catch
errors yet.