I worked on smaller internal things today. I made error reporting a little more useful on interpreter / repl level. It's now similar to rebol's where you get the "error happened near this code".
I could and will add much more info to errors, but additional error reporting will incur some allocation cost and I will do that when I can / have time to test for the costs. The level of error reporting will probably be configurable, so you use that option only when you are debugging.
There are few examples on screenshot below. Rye has quite unusual error handling ideas. I will need to write about them sooner or later. So far they seems to work quite OK, but I need to write more real life code to make this any more final.
In very very short, it distinguishes between (coding) errors and failures (to accomplish the objective). A failure is information (rye value) like all other. If failure is not handled it becomes an error. You don't handle errors, you fix the code.
It also looks at failure handling as a translation from system to user-space. More on that and related things later.
NOTE: If you are looking at the code, the words beginning with ^ are returning words. They do something and also return to caller. So far it's a naming convention, but it could become it's own word type.
NOTE: Failures are not just strings like in these examples. String is just a message part of failure value.
Komentarji
Objavite komentar