junrushao opened a new issue, #234:
URL: https://github.com/apache/tvm-ffi/issues/234

   **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>` where `T` is any type TVM-FFI supports but not 
`tvm::ffi::Error`; Err is always `ffi::Error`.
   - Extend `ffi::Function` invocation helpers so users can request wrappers of 
type `(Args...) -> ffi::Expected<T>`; calls that produce an `ffi::Error` fill 
the error branch instead of throwing.
   - Allow registering functions that implement `(Args...) -> 
ffi::Expected<T>`; the dispatcher should convert returned `Expected` objects 
into the existing error propagation path so current exception-based APIs keep 
working.
   - Document usage patterns, including examples of calling and registering 
`Expected` functions, and guidance on when to "use exception" vs. `Expected` 
flows.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to