I really like tl::expected. It makes C++ code really nice to work with.
However, I am worried about making Python bindings if most functions have output types wrapped in expecteds.
Critically, nanobind does not support this (nor should it because it's a C++17 library and this feature is 23? (see discussion)), so we'd have to essentially encase all our bindings into lambdas that check the expected and do a custom thing on the Python side in the event of failure -- like raise an exception.
I'm sure this is macroable, but... is it worth it? I wanted to open up some discussions here.
cc @eholum @v4hn (because I can pick on you)
I really like
tl::expected. It makes C++ code really nice to work with.However, I am worried about making Python bindings if most functions have output types wrapped in
expecteds.Critically,
nanobinddoes not support this (nor should it because it's a C++17 library and this feature is 23? (see discussion)), so we'd have to essentially encase all our bindings into lambdas that check the expected and do a custom thing on the Python side in the event of failure -- like raise an exception.I'm sure this is macroable, but... is it worth it? I wanted to open up some discussions here.
cc @eholum @v4hn (because I can pick on you)