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 DispatchKernel
inconcrete_dispatch_kernel
to convert fromValue
to specific typeT
- in
impl DispatchKernel
insymbolic_dispatch_kernel
to convert fromSymbolicValue
toSymbolic<T>
- in
impl UnaryKernel/BinaryKernel/..
in (hybrid)kernel
to 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>