squiggle
squiggle copied to clipboard
Don't fail on parse, analysis, runtime errors
Squiggle programs don't have to fail when execution can partially succeed. (Normal programs have side effects, so continuing execution is dangerous, but Squiggle is pure).
Examples:
- when parse fails at line 100, we can still show all values from lines 1-99, and if the parser has recovered from an error, we can even continue execution below the failed line
- when types don't match, we can highlight failed variables, but execute everything else
- on runtime errors, we can store "VError" in the failed variable and proceed
One downside of this approach is that we'll consume more CPU: if your program is x = longComputation(); y = , and you're still typing the value for y, it'll run x more times.
But this can be improved with:
- partial caches based on hashes of AST nodes
- web workers
- disabling autoruns, since it's only a problem when your entire program is slow