On Feb 14, 2009, at 10:13 AM, Nicolas M. Thiery wrote:

>
>       Dear Robert,
>
> On Thu, Feb 12, 2009 at 11:34:02PM -0800, Robert Bradshaw wrote:
>>
>> I have written up extensive documentation on the coercion model at
>> http://wiki.sagemath.org/coercion . If you find coercion baffling,
>> confusing, or unuseful, this is especially for you. I am sure there
>> is lots of room for improvement, as what may be obvious to me can be
>> far from obvious to those less familiar with the system. This is
>> intended to be the guide to using coercion--for deeper implementation
>> details see the docstrings in the coerce.pyx (100% coverage) and
>> related files.
>>
>> Eventually, this should all be moved to the reference manual and/or
>> programing guide, but I figured the wiki was the best place to put it
>> at the moment. Comments welcome.
>
> Great! Thanks very much.

You're welcome. It's long overdue :).

> Would it be possible to add the following functionality (with whatever
> appropriate syntax):
>
>       declare_conversion(source, target, morphism)
>
> which would adds the morphism from source to target to the conversion
> list (and probably similarly for coercions). Having some restrictions
> on it (like making sure it's called before any coercion/conversion is
> attempted) is no problem.
>
> This functionality will make it possible for each category to
> automatically declare the relevant morphisms, independently of the
> other categories (like if A is in Algebras(K), then this category will
> declare the natural morphism from K to A).


This functionality is certainly possible, but the decision was made a  
long time ago that Parents are supposed to be immutable. One problem  
is that asserting embeddings can drastically change how things  
operate globally, and one of the goals of coercion is to be stateless  
(from the user's point of view, of course it caches things for speed)  
and consistent. However, I can see how a command like this could be  
very useful. The restriction that it be called before any coercion  
take place seems very reasonable to me (and I'm less worried about  
conversions, but better safe than sorry). I'd like to have feedback  
from other people too though--I remember last time this came up there  
was concern over the problems Magma's "assert embedding" caused.

Another thing that we talked about way back, but never got around to  
implementing, was contextual coercions, e.g.

with embedding(...):
     do stuff using that coercion
# coercion doesn't work anymore here

- Robert



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to