Bridging Swift Error Handling Model to C++

01/24/2023
by   Roberto Rosmaninho, et al.
0

Error handling is the process of responding to and recovering from error conditions in the program. In Swift, errors are represented by values of types that conform to the Error protocol. Throwing an error lets you indicate that something unexpected happened, and the normal flow of execution can't continue. A throw statement is used to throw an error. Optional returns are used to represent the absence of a value, but when an operation fails, it's often useful to understand what caused the failure so that code can respond accordingly. Therefore, I propose to bridge the Swift Error Handling modeling to C++ to improve the interoperability between the programming languages. The main idea is to be able to throw a C++ exception that stores a thrown Swift Error that has to be represented by a C++ class. In addition to that, to support C++ programs that don't use exceptions, I propose an additional interoperability mode for throwing functions. When C++ exceptions are disabled, C++ functions should return a result value that contains either the value returned by the function or the Swift Error value: the Swift::Exception<T> class.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
10/31/2018

Exceptionally Monadic Error Handling

We notice that the type of src_haskellcatch :: c a -> (e -> c a) -> c a ...
research
09/13/2018

Bounded Symbolic Execution for Runtime Error Detection of Erlang Programs

Dynamically typed languages, like Erlang, allow developers to quickly wr...
research
07/05/2019

Incrementally Learning Functions of the Return

Temporal difference methods enable efficient estimation of value functio...
research
11/12/2019

Scheme Macros for Non-linear Pattern Matching with Backtracking for Non-free Data Types

Pattern matching is an important feature of programming languages for da...
research
08/02/2017

Revisiting Exception Handling Practices with Exception Flow Analysis

Modern programming languages, such as Java and C#, typically provide fea...
research
01/16/2019

Predicting Variable Types in Dynamically Typed Programming Languages

Dynamic Programming Languages are quite popular because they increase th...
research
10/04/2021

A Markov process approach to untangling intention versus execution in tennis

Value functions are used in sports applications to determine the optimal...

Please sign up or login with your details

Forgot password? Click here to reset