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

Result Thoughts about Leaf / Outcome & PR0709 #16

Open
GregBowyer opened this issue Jan 23, 2020 · 1 comment
Open

Result Thoughts about Leaf / Outcome & PR0709 #16

GregBowyer opened this issue Jan 23, 2020 · 1 comment

Comments

@GregBowyer
Copy link

Hi there, this library looks interesting.

I was wondering if you had any thoughts on "converting" simple rust errors (say of the ErrKind flavor) into boilerplated errors from one of the following C++ libraries:

@dtolnay
Copy link
Owner

dtolnay commented Jan 23, 2020

This isn't something I plan to tackle in the near term, but I do have some loose plans for how we will expose customization of the mapping between the languages. Codebases that use the different error approaches from your links, or that use exceptions, will want a Rust Result value to turn into somewhat different code coming out of our C++ code generator. Relatedly, codebases that use a nonstandard string type will want some way to get smooth interop with that on the Rust side.

There is more design work to do, but I'd like for this stuff to not be built as special cases in this project. Instead such customization would be exposed in a sort of plugin mechanism where the codegen behavior is defined by a Rust procedural macro or something like that, and all our native types for which we ship support out of the box would be implemented through that same mechanism.

Then for something like Leaf/Outcome it would be a matter of someone writing the procedural macro that implements the understanding of how to operate on those types, putting it on crates.io, and then we register the dependency in Cargo.toml and use its types in our FFI signatures.

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