|
| 1 | +# Upgrade to SymbolicUtils v1 |
| 2 | + |
| 3 | +The version 1 of SymbolicUtils utilizes |
| 4 | +[Unityper](https://github.com/YingboMa/Unityper.jl) to speed up the compilation |
| 5 | +time. We introduce a new type `BasicSymbolic <: Symbolic` to represent all the |
| 6 | +previous types `Sym`, `Term`, `Add`, `Mul`, `Pow` and `Div`. Since |
| 7 | +`BasicSymbolic` is a concrete type, checking `x isa Sym` or `x isa Pow` no |
| 8 | +longer works. Instead, one should use `issym(x)` or `ispow(x)` to check the |
| 9 | +"type" of the expression. Also, note that if one does not need to work on a |
| 10 | +specific symbolic representation, `issym(x)` and `isterm(x)` should be replaced |
| 11 | +by `x isa Symbolic && !istree(x)` and `istree(x)` to be more generic. |
| 12 | +Furthermore, dispatching on `Sym`, `Term`, etc no longer works. Instead, a |
| 13 | +function that takes `BasicSymbolic` should check the type of the expression |
| 14 | +using a `if` statement to select the right code path. |
| 15 | + |
| 16 | +Although we don't have `Sym`, `Term`, etc in the Julia type system anymore, we |
| 17 | +still provide convenient constructors for them. For example, `Sym{Real}(:x)` |
| 18 | +would still work. For constructor that takes a collection like `Term`s, we |
| 19 | +recommend directly construct `Any` element type constructors like `Term(f, |
| 20 | +Any[x1, x2])` to reduce extra memory allocation and compile time. |
0 commit comments