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

Integrate run-time assertions with Céu Exceptions #139

Open
jhoehle opened this issue Mar 16, 2019 · 1 comment
Open

Integrate run-time assertions with Céu Exceptions #139

jhoehle opened this issue Mar 16, 2019 · 1 comment

Comments

@jhoehle
Copy link
Contributor

jhoehle commented Mar 16, 2019

As of today, Céu apps

  1. pay the run-time overhead of checking each and every index against array bounds,
  2. ... but without reaping the benefits, IOW without offering a controlled way to react to the out of bounds situation.
    The app just crashes using ceu_assert/abort. This feals very unsatisfactory.

Ideally, when CEU_FEATURES_EXCEPTION is enabled, ceu_assert should somehow lead to ceu_throw such that I can write some error handler and e.g. let my game restart at the current level or whatever the programmer decides is appropriate.

Easier said than done. Céu's Exception appears akin to checked exceptions, whereas what is required here is run-time or unchecked exceptions.

Perhaps the internal assertions could be split in two groups: fatal ones, e.g. out of memory and internal consistency checks on one hand and recoverables ones like loop/limit violations OTOH.

BTW, why can't code/call locally catch an exception? (cf. src/tests.lua around line 45860) The internal reason appears to be that catch expands to par/or and finalize, but what is the user story, how to teach that? (catch/throw doesn't naïvely appear as a member of synchronous control statements to me.)

@fsantanna
Copy link
Collaborator

BTW, why can't code/call locally catch an exception?

It's an implementation limitation: code/call blindly uses the C stack with no runtime overhead/intervention.

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

No branches or pull requests

2 participants