-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Goal Enable an exception-free C++ API by introducing an ffi::Expected<T> type (mirroring std::expected / Rust Result) and wiring it through ffi::Function invocation and registration.
Problem Current ffi::Function calls always return Any; failures rely on exceptions. Consumers needing hard real-time or exception-free environments lack a native way to detect errors without exceptions, and we can’t guanratee callbacks are all exception-free.
Proposal
- Add
ffi::Expected<T>whereTis any type TVM-FFI supports but nottvm::ffi::Error; Err is alwaysffi::Error. - Extend
ffi::Functioninvocation helpers so users can request wrappers of type(Args...) -> ffi::Expected<T>; calls that produce anffi::Errorfill the error branch instead of throwing. - Allow registering functions that implement
(Args...) -> ffi::Expected<T>; the dispatcher should convert returnedExpectedobjects into the existing error propagation path so current exception-based APIs keep working. - Document usage patterns, including examples of calling and registering
Expectedfunctions, and guidance on when to "use exception" vs.Expectedflows.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request