This is something we agonized over quite a bit. I think Sym <: Number
is just plain not good enough. We want to be able to support symbolic Float64
s, Matrix
s, String
s or really any datatype. One approach would be to just create a billion SymbolicX
types which subtype X
, but that has many downsides.
What we really want is Sym{T} <: T
, but that’s not supported by Julia’s semantics, however it can actually be done inside an IRTools.jl pass like I show in this proof of concept. I plan to investigate this approach further.
One thing I feel somewhat strongly about is that this package can’t just be for math on numbers. It should have wider applicability than that. Mathematica has many flaws, but I think it demonstrates the value of symbolic programming in all sorts of domains outside simple math.