roc-lang / roc

A fast, friendly, functional language.
https://roc-lang.org
Universal Permissive License v1.0
3.86k stars 284 forks source link

Explore graceful error handling for REPL #6722

Open Anton-4 opened 1 month ago

Anton-4 commented 1 month ago

Crashes/panics during e.g. roc dev file.roc are not such a big deal, but in the REPL you've now lost all your state and you need to restart. We should think about non-crashing error handling for all code used by the REPL. We should still have an option to print backtraces on error because those can be useful in some cases.

kukimik commented 1 month ago

This may also be discouraging for newcomers. For instance, I wanted to experiment with the language in the online REPL (mainly with open/closed record types, as described in the tutorial) before taking the effort to actually install anything, but I experienced so many crashes that I gave up. I think I'll try the offline version, because I find the language interesting, but I imagine some potential users could drop out at this point.

Anton-4 commented 1 month ago

Agreed!

Anton-4 commented 1 month ago

A good first step here could be to produce nice error messages when something is not implemented, like in the todo's here. You can produce that panic by entering F = \x -> x % 3 in the (web) repl.