Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document runtime error handling #533

Open
Akuli opened this issue Dec 12, 2024 · 2 comments
Open

Document runtime error handling #533

Akuli opened this issue Dec 12, 2024 · 2 comments

Comments

@Akuli
Copy link
Owner

Akuli commented Dec 12, 2024

I think the best way to handle errors in Jou is:

  • return special values (e.g. NULL or -1) in stdlib
  • use assert in quick and dirty scripts (e.g. AoC solutions)
  • use a custom error handling function in larger projects (e.g. Jou compiler).

Advantages:

  • Super simple
  • Requires no special features in language/compiler
  • User chooses how to handle errors

Disadvantages:

  • No standard way to get a human-readable error message string
  • No compiler warning if you forget to handle error case

This seems like a reasonable tradeoff for Jou, even though it's not a good solution in most other languages. It's also basically what C does.

This should be documented.

@Akuli Akuli changed the title Runtime error handling Document runtime error handling Dec 12, 2024
@Akuli Akuli mentioned this issue Dec 12, 2024
@Moosems
Copy link

Moosems commented Dec 12, 2024

Will there be a way to try/except for assertion errors?

@Akuli
Copy link
Owner Author

Akuli commented Dec 12, 2024

No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants