AlgebraicJulia / DiagrammaticEquations.jl

MIT License
6 stars 1 forks source link

Use structs for inference and overloading rules #53

Open GeorgeR227 opened 1 week ago

GeorgeR227 commented 1 week ago

Currently we use named tuples to hold our rules for type inference and overloading but that means we have massive type signatures in each of our functions. We should instead just use structs to hold this same information.

Instead of something like op2_rules::Vector{NamedTuple{(:proj1_type, :proj2_type, :res_type, :resolved_name, :op), NTuple{5, Symbol}}} we could just have op2_rules::Vector{Op2Rule}, holding the same information.

We might even be able to tie groups of rules together, like type rules, with an abstract type that allows us to dispatch and choose the correct type inference application function.

jpfairbanks commented 6 days ago

Yes that makes sense to me. If you have multiple functions that take namedtuples with the same signature, then make it a struct. It should be exactly the same performance-wise.