vtjnash / Polynomial.jl

Polynomial manipulations
Other
6 stars 10 forks source link

Var in type? #28

Closed andrewcooke closed 10 years ago

andrewcooke commented 10 years ago

When you have binary operations on polynomials you raise an error if the variable doesn't match. If you put the variable in the type (I just found out that types can include symbols) then you could disallow this through the type system.

So Poly would become something like data Poly{var::Symbol, T<:Number} and you wouldn't need the var attribute (or component, or whatever Julia calls these things).

vtjnash commented 10 years ago

this puts unnecessary work on the type system and JIT, potentially making it slower, and making the error message worse (it's called a type parameter). doing everything in meta-programming just because you can is generally not a good idea