SymbolicUtils.jl icon indicating copy to clipboard operation
SymbolicUtils.jl copied to clipboard

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

Open MasonProtter opened this issue 3 years ago • 3 comments

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).

MasonProtter avatar Oct 03 '21 03:10 MasonProtter

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

shashi avatar Oct 04 '21 16:10 shashi

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 avatar Oct 04 '21 16:10 MasonProtter

Maybe a trait like Addable

MasonProtter avatar Oct 04 '21 16:10 MasonProtter