Nils Bruin wrote:
> I think the only choice (if any) is to match the occurrence of a name
> in the smallest ring.
> 
> If your generic code is relying on coercion in a setting where name
> matching like this is relevant, I suspect it's almost certainly the
> wrong choice.

I think we agree. To clarify, what I was trying to say is that

(1) Forbidding polynomial ring towers with repeated variables breaks 
essentially all code that creates polynomial rings for its private use 
over base rings provided by the caller, even code that doesn't use 
coercion, say

def foo(a):
    Pol = PolynomialRing(a.parent(), 'x')
    return Pol([a, 1]).roots()

(Everyone in this thread probably agrees on that part.)

(2) Disallowing conversions from R to R[x] when R already contains a 
variable called x doesn't sound great to me either. Indeed, converting 
constants into polynomials is a pretty common operation, it is quite 
idiomatic to use parent-call syntax for that, and it may not be obvious 
on first sight that it could fail in some cases. Whereas I can only 
think of rather contrived examples where one would write Pol(p) in a 
situation where ambiguity may occur and expect it to map the variable of 
the polynomial p to that of the ring Pol. (Not only the pitfall is more 
evident, but also there are often other natural tools to do the job, 
e.g. change_ring() methods.)

-- 
Marc

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/r0c64n%243c3s%241%40ciao.gmane.io.

Reply via email to