You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Multiple blob types may support the same type of operation. For example, a matrix, and a window over a matrix, will both support operations like getting the width, height, row retrieval, column retrieval, etc
The normal rust thing is to have a trait which defines contracts for these operations, which both types then implement. However, since we cannot retrieve trait types directly, any foreign predicate that serves multiple blob types still has to have a big check block to see what sort of blob it is dealing with and dispatch accordingly.
It would be good if we had some way to retrieve an object from a term which is able to do this dispatch for us. Directly retrieving a dyn T would be ideal, but this may be too tricky to get right.
Maybe there could be another macro like dispatch_arc_blob!(DispatchType, TraitType, [ConcreteType1, ConcreteType2, ConcreteType2]) which generates an enum type DispatchType with cases for all given concrete types (that all implement TraitType), and provides an implementation of TraitType that dispatches to the inner object.
The text was updated successfully, but these errors were encountered:
Multiple blob types may support the same type of operation. For example, a matrix, and a window over a matrix, will both support operations like getting the width, height, row retrieval, column retrieval, etc
The normal rust thing is to have a trait which defines contracts for these operations, which both types then implement. However, since we cannot retrieve trait types directly, any foreign predicate that serves multiple blob types still has to have a big check block to see what sort of blob it is dealing with and dispatch accordingly.
It would be good if we had some way to retrieve an object from a term which is able to do this dispatch for us. Directly retrieving a
dyn T
would be ideal, but this may be too tricky to get right.Maybe there could be another macro like
dispatch_arc_blob!(DispatchType, TraitType, [ConcreteType1, ConcreteType2, ConcreteType2])
which generates an enum typeDispatchType
with cases for all given concrete types (that all implementTraitType
), and provides an implementation ofTraitType
that dispatches to the inner object.The text was updated successfully, but these errors were encountered: