Open lamorton opened 3 years ago
The right way to check for a symbolic expression is:
Symbolics.unwrap(x) isa Symbolics.Symbolic
The right way to use dispatch would be:
foo(x) = _foo(unwrap(x))
_foo(x::Symbolic) = ... actually do foo ...
_foo(x) = ... do something else? ...
The thing that is done in RecursiveArrayTools seems to be to avoid dependency on Symbolics there.
The right way to use dispatch would be:
You can't do that on getindex
. That gives ambiguities.
You can define
getindex(A::SciMLBase.AbstractNoTimeSolution, sym::FillArray)
and
getindex(A::SciMLBase.AbstractNoTimeSolution, sym::Any)
will get the symbols, you can unwrap there if you want.
In order to replace
issymbollike
& solve method ambiguities for AD rules,SciMLBase
could depend onSymbolics
. Cf. this remark. by @sharanry in #85.Currently, we can't do this b/c
Symbolics.jl
depends onSciMLBase
here.issymbollike
fromSciMLBase
is extended in Symbolics: hereThe original definition of
issymbollike
is inRecursiveArrayTools
here.SciMLBase
depends onRecursiveArrayTools
here.Symbolics
could define anAbstractSymbol
type,RecursiveArrayTools
could use this for dispatching instead of branching onissymbollike
, but in order to make this work we need to make sureSymbolics
doesn't depend onSciMLBase
.Edit: It appears that the only mention of
SciMLBase
withinSymbolics
is whereissymbollike
is extended. I'm gonna do a smoke test & make sure.