While looking into #1979 I noticed that caching for universal polynomial rings is implemented in a weird way, which is incompatible with the ideas I have for #1979. I'm not sure if there even is a sensible way to implement caching in this case. As far as I understand, currently the caching for universal polynomial rings doesn't depend on the variables. So if I create a universal polynomial ring and add some variables to it and then create a new one, the new one will have the same variables as the old one. I my opinion this even contradicts the docstring of universal_polynomial_ring:
Given a base ring R, return an object representing
the universal polynomial ring $S = R[\ldots]$ with no variables in it initially
This is now caching looks in action:
julia> R=universal_polynomial_ring(QQ)
Universal Polynomial Ring over Rationals
julia> x=gen(R,:x)
x
julia> gens(R)
1-element Vector{AbstractAlgebra.Generic.UnivPoly{Rational{BigInt}}}:
x
julia> S=universal_polynomial_ring(QQ)
Universal Polynomial Ring over Rationals
julia> gens(S)
1-element Vector{AbstractAlgebra.Generic.UnivPoly{Rational{BigInt}}}:
x
julia> gen(S,:y)
y
julia> gens(R)
2-element Vector{AbstractAlgebra.Generic.UnivPoly{Rational{BigInt}}}:
x
y
Is there a use case for caching for universal polynomial rings?
While looking into #1979 I noticed that caching for universal polynomial rings is implemented in a weird way, which is incompatible with the ideas I have for #1979. I'm not sure if there even is a sensible way to implement caching in this case. As far as I understand, currently the caching for universal polynomial rings doesn't depend on the variables. So if I create a universal polynomial ring and add some variables to it and then create a new one, the new one will have the same variables as the old one. I my opinion this even contradicts the docstring of
universal_polynomial_ring:This is now caching looks in action:
Is there a use case for caching for universal polynomial rings?