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

`@varnames_interface`: warn or even reject duplicate variable names?

Open fingolfin opened this issue 6 months ago • 1 comments

It probably isn't a good idea to use the same variable names multiple times, like here:

julia> polynomial_ring(QQ, :x=>1:2, :x=>1:3)
(Multivariate polynomial ring in 5 variables over QQ, QQMPolyRingElem[x[1], x[2]], QQMPolyRingElem[x[1], x[2], x[3]])

Should we catch this and either print a warning, or outright error? My guess is that this mostly happens due to user error (e.g. a typo changing y to x)

It would be easy enough to do by inserting an allunique call in a suitable spot. Of course that in turn slows down things.

If we decide against it, perhaps we should at least insert a warning comment in the polynomial_ring docstring that this is not checked for?

fingolfin avatar Jul 29 '24 18:07 fingolfin