Bridging Swift Error Handling Model to C++
Roberto Rosmaninho

TL;DR
This paper proposes a method to bridge Swift's error handling model with C++, enabling seamless interoperability by allowing Swift errors to be represented as C++ exceptions or result values, enhancing cross-language error management.
Contribution
It introduces a novel approach to integrate Swift's error handling into C++, including exception translation and an alternative mode for non-exception C++ code.
Findings
Enables C++ to throw Swift errors as C++ exceptions.
Supports non-exception C++ code with result-based error handling.
Improves interoperability between Swift and C++ error management.
Abstract
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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware System Performance and Reliability · Parallel Computing and Optimization Techniques · Distributed and Parallel Computing Systems
