JuliaSymbolics / SymbolicUtils.jl

Symbolic expressions, rewriting and simplification
https://docs.sciml.ai/SymbolicUtils/stable/
Other
536 stars 107 forks source link

Does `Add` need symtype `<:Number`? #376

Open MasonProtter opened 2 years ago

MasonProtter commented 2 years ago

Currently, we have that Add can only be used for symtypes that are <: Number, this feels a little unnecessary. Lots of things can have a notion of addition, and it's almost always associate and commutative so it seems natural to be relaxed about what can go into Add (even if they don't go into it by default).

shashi commented 2 years ago

It's there as an easy way to debug type promotion bugs. But yes, in theory it won't be needed.

MasonProtter commented 2 years ago

One thing we could do is allow Add for non-Numbers, but not expose any constructors for it, so that people who want it have to opt in manually.

MasonProtter commented 2 years ago

Maybe a trait like Addable