>  Wait -- it's perfectly fine that M(0) works!  It's only bad if this
>  were to work:
>
>  sage: M._coerce_impl(0)
>  (0, 0, 0)
>
>  In fact, the above does work.   That's because this code is wrong:
>
>     def _coerce_impl(self, x):
>         """
>         Canonical coercion of x into this free module.
>             (0, 4/3, 8/3, 4, 16/3)
>         """
>         if isinstance(x, (int, long, sage.rings.integer.Integer)) and x==0:
>             return self.zero_vector()
>         ...
>
>

Ah, so I'm just confused about what means what with the coercion
model. You're saying that M(0) is perfectly fine, because there I'm
just asking M to give me a meaningful interpretation of 0, which of
course it can and does. However, _coerce_impl should only be able to
coerce x into self if there is a coercion from all of x.parent() to
self, which is canonical as far as the coercion model is concerned. So
this is exactly the example that Gonzalo has mentioned several times
before -- there should be no coercion from Q to GF(3), but GF(3)(1/4)
returning 1 isn't bad.

Given that David and Robert are mostly done rewriting the coercion
code, I'd say we should wait a few weeks to decide if this is still
relevant. ;)

>  Whenever one group is contained in another, coerce.
>

Patch coming up. I think the fact that you used the phrase "most
canonical" embodies what I was worried about. On the other hand, I
don't think there's any way it could cause confusion to have coercions
in this case, and it would be really annoying to *not* have them.

-cc

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to