DarkSharpness commented on issue #265:
URL: https://github.com/apache/tvm-ffi/issues/265#issuecomment-3573608568

   @tqchen I believe a static `TypedOverloadedFunc`, which takes a list of 
Callables as template arguments, is likely the most efficient implementation: 
the compiler can (hopefully) inline each candidate and minimize dispatch 
overhead.
   
   However, the trade-off is reduced API flexibility. In the static style, 
users must explicitly enumerate all overloads in a single `Def` invocation. 
This makes certain advanced patterns, such as cross-module overloads where 
functions with the same name are registered in different modules, harder or 
impossible.
   
   Example APIs:
   
   static-style:
   ```c++
   GlobalDef().def("func", TypedOverloadedFunc{FnA, FnB});
   ```
   
   dynamic style:
   ```c++
   GlobalDef().def("func", FnA);
   // somewhere else
   GlobalDef().def("func", FnB);
   ```
   
   Both style make sense to me.
   


-- 
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