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

Missing try/finally #1929

Open
jurgenvinju opened this issue Mar 23, 2024 · 0 comments
Open

Missing try/finally #1929

jurgenvinju opened this issue Mar 23, 2024 · 0 comments
Assignees

Comments

@jurgenvinju
Copy link
Member

jurgenvinju commented Mar 23, 2024

Describe the bug

I would like to be able to write try-finally blocks like so:

try {
 ...
}
finally {
  ...
}

but this is not in the syntax of Rascal.

Example usage:

void job(str label, void (void () step) block) {
   try {
     jobStart(label);
     block(() { jobStep(label, label, work=1);});
   }
   catch x: {
     throw x; // this rethrow erases the location of the original, also it doesn't add functionality to the code.
   }
   finally {
     jobEnd(label); // this is essential. I need to do this also when exceptions pop the stack.
   }
}
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