I think it's fine to require that objects in a category support
weakrefs.  There are certainly categories where you might want
integers to be the objects, but then I think that you need to wrap
those integers in some class inheriting from CategoryObject.

Simon, where were you planning on adding this new requirement to the
documentation?  Is there a good place in the Developer guide?
David

On Mon, Dec 19, 2011 at 16:11, Simon King <[email protected]> wrote:
> Hi William
>
> On 19 Dez., 22:43, William Stein <[email protected]> wrote:
>> But I'm personally OK with loosing this feature.   The feature we're
>> loosing though is this: objects of a category have to support weak
>> references.
>>
>> Is that feature OK to loose?   I can't think of a reason we need that 
>> feature.
>
> We certainly do not loose that feature - because that feature simply
> does not exist.
>
> Namely, any element is considered to be an object in some category,
> such as
>  sage: 1.category()
>  Category of elements of Integer Ring
>
> However, sage.structure.element.Element does not support weak
> references, such as
>  sage: weakref.ref(1)
>
> ---------------------------------------------------------------------------
>  TypeError                                 Traceback (most recent
> call last)
>
>  /home/simon/SAGE/sage-4.8.alpha3/<ipython console> in <module>()
>
>  TypeError: cannot create weak reference to
> 'sage.rings.integer.Integer' object
>
>
> So, there currently *are* objects of some strange category that do not
> support weak references - which is why these 3 times 2 doctests fail
> when using a weak cache for homsets.
>
> Cheers,
> Simon
>
> --
> To post to this group, send an email to [email protected]
> To unsubscribe from this group, send an email to 
> [email protected]
> For more options, visit this group at 
> http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org

-- 
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to