moose
moose copied to clipboard
Limit use of TryFrom in kernel macros
The use of TryFrom in the kernel macros can lead to confusion since it's a very general pattern that doesn't convey what's happening very clearly.
We are currently using TryFrom in two places in the macros:
- in
impl DispatchKernelinconcrete_dispatch_kernelto convert fromValueto specific typeT - in
impl DispatchKernelinsymbolic_dispatch_kernelto convert fromSymbolicValuetoSymbolic<T> - in
impl UnaryKernel/BinaryKernel/..in (hybrid)kernelto convert fromSymbolic<T>to eitherSymbolic<T>orT(via rust type inference)
Perhaps the first two are okay, but at least the latter should probably be given it's own trait or even just a fn on Symbolic returning eg an Option<T>