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

Generalized support for error lifting #195

Open
jclark opened this issue Jun 12, 2019 · 1 comment
Open

Generalized support for error lifting #195

jclark opened this issue Jun 12, 2019 · 1 comment
Labels
enhancement Enhancement to language design lang Relates to the Ballerina language specification
Milestone

Comments

@jclark
Copy link
Collaborator

jclark commented Jun 12, 2019

Consider adding generalized support for error lifting. Error lifting for an operator means that if an operand evaluates to an error e, then the result of the operation is e.

Some initial thoughts:

  • Subtle difference to lax typing of error in that lifted operator that gets an error operand will return that error rather than create a new error.
  • If operands do not allow errors and result of operation can never be an error, then should be safe to do lifting automatically. Otherwise might need to be explicit.
  • Rather than doing this operator by operator, feels like something that should have a general solution. (For example, solution might look like contextually expected type: syntax that establishes a context in which errors get lifted.)
  • Generalized error lifting (which leverages error being a distinct type) would be a significant step towards reducing the awkwardness that comes from using explicit error handling rather than exceptions
  • Not a good idea for lang.* functions to try and do it manually, because it is hard to get precise typing of error values.
  • Related to lax typing in that when you really want to lift errors when you are doing lax typing.
  • Feels like something generally useful.
@jclark
Copy link
Collaborator Author

jclark commented Jun 17, 2019

An idea for a special case of this was #109

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to language design lang Relates to the Ballerina language specification
Projects
None yet
Development

No branches or pull requests

1 participant