-
Couldn't load subscription status.
- Fork 124
Description
Having == construct an equation might be a good idea if this package were a standalone CAS, like Mathematica. But it's meant to work with the larger Julia ecosystem. The semantics of == in Julia at large is consistent. The semantics here is completely different, which means you using Sym in generic code will often do the wrong thing, in fact throw an error.
I can't find a single instance in Julia where a == b does not return Bool. Maybe there is one, but I can't find it. This line in Base.jl is largely responsible:
==(x, y) = ===(x,y)You have...
julia> @code_typed ["aa"] == 3
CodeInfo(
1 ─ return false
) => Bool
julia> @code_typed Base == 3
CodeInfo(
1 ─ return false
) => BoolAs a result, this assumption is made everywhere in the Julia ecosystem.
This issue is similar to #15. I did not check this against the version of SymbolicUtils in that issue, but I think the problem there was also that == does not return a Bool, not simplification.
I noticed this a couple of years ago, and may have posted something somewhere. But I want to state the issue clearly. I can't think of a function in Julia that is more widespread and with more consistent semantics than Base.==. And the method defined for ::Sym breaks this consistency for the sake of giving the frontend experience of Mathematica. This makes SymbolicUtils more like a DSL and less like a library for use in other Julia projects.
A response could be "just use isequal". But that would miss my point. Julia is about composability an genericness. (And isequal has a different, specified, semantics.)
(btw. +100 on performance of rules and of load time of SymbolicUtils! This makes it easier to argue for Julia.)