On Sun, Mar 1, 2009 at 5:11 PM, William Stein <wst...@gmail.com> wrote:
> On Sun, Mar 1, 2009 at 12:26 PM, William Stein <wst...@gmail.com> wrote:
>> On Fri, Feb 13, 2009 at 2:34 AM, Robert Bradshaw
>> <rober...@math.washington.edu> 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.
>>>
>>> - Robert
>>
>> I was just looking at this from the context of implementing quaternion
>> algebras (again) using this framework.  It's actually striking how
>> most of the code in Sage does not use the new coercion framework.
>> The vast majority of rings and other objects in Sage still use the old
>> framework.  E.g., there are 88 uses of the deprecated _coerce_impl and
>> there are only about 12 uses of the new _populate_coercion_list
>> replacement.  Because it hasn't got used so much in Sage, maybe the
>> new coercion model implementation probably has a lot of kinks to be
>> worked out, and people will likely run into these when trying to
>> implement classes that use it.
>>
>> For example, I tried to get pickling of quaternion algebras to work --
>> and it won't if I use
>>
>>          self._populate_coercion_lists_(coerce_list=[base_ring])
>>
>> in my code.    It gave "weird errors" unless I comment it out, so I
>> checked around Sage (e.g., in free modules) for any other uses of this
>> pretty natural obvious use of populate_coercion_list in any deployed
>> code.  There are 2 or 3 instances in all Sage of this.   Not enough to
>> educate me.

Robert -- just a quick followup -- I defined a straightforward
__reduce__ method and suddenly pickling just worked fine for my new
QuaternionAlgebras class.

 -- William

--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to