Skip to content

Even Safer Exceptions #15510

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

Open
odersky opened this issue Jun 23, 2022 · 1 comment
Open

Even Safer Exceptions #15510

odersky opened this issue Jun 23, 2022 · 1 comment
Labels
area:saferExceptions scala.language.experimental.saferExceptions Semester Project Good project to be done by an MSc or strong Bsc computer science student in one semester stat:taken This project is already worked on by a student or as part of another volunteership program

Comments

@odersky
Copy link
Contributor

odersky commented Jun 23, 2022

Safer exceptions uses capabilities to express possible throws of checked exceptions. It is currently not completely safe since the capability to throw an exception can escape the scope where it is valid. Example:

def f(x: Int): Int throws E
val xs: List[Int]
try
  xs.iterator.map(f)
catch case ex: E => Nil

This is unsafe since the exception might be thrown only after the try has exited. So the thrown exception might not be caught.

With capture checking we now have a means to detect cases like this, so we can move safer exceptions to the next stage.

The goals of this project are:

  • eliminate shortcomings for existing safer exceptions. For instance, we should detect exceptions thrown in Java code.
  • combine safe exceptions with capture checking in the research branch cc-experiment.
  • develop a range of test cases to demonstrate that the checking works and that unsafe code is rejected.
  • maybe port (parts of) an existing application or library to checked exceptions.

The project is for someone who likes working with bleeding edge research prototypes and to push the envelope of what we can do with them. The project could have wider impact as a publishable case study of what we can do with capture checking, and how this approach solves Java's problems with checked exceptions by supporting effect polymorphism better.

@odersky odersky added stat:needs triage Every issue needs to have an "area" and "itype" label Semester Project Good project to be done by an MSc or strong Bsc computer science student in one semester and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jun 23, 2022
@Kordyjan Kordyjan added the area:saferExceptions scala.language.experimental.saferExceptions label Jun 23, 2022
@mbovel mbovel added the stat:taken This project is already worked on by a student or as part of another volunteership program label Jul 29, 2022
@mbovel
Copy link
Member

mbovel commented Jul 29, 2022

@hamzaremmal will work on this next semester.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:saferExceptions scala.language.experimental.saferExceptions Semester Project Good project to be done by an MSc or strong Bsc computer science student in one semester stat:taken This project is already worked on by a student or as part of another volunteership program
Projects
None yet
Development

No branches or pull requests

3 participants