#10963: More functorial constructions
-------------------------------------+-------------------------------------
       Reporter:  nthiery            |        Owner:  stumpc5
           Type:  enhancement        |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-6.1
      Component:  categories         |   Resolution:
       Keywords:  days54             |    Merged in:
        Authors:  Nicolas M. Thiéry  |    Reviewers:  Simon King, Frédéric
Report Upstream:  N/A                |  Chapoton
         Branch:                     |  Work issues:  Detect and fix
  public/ticket/10963                |  Heisenbugs
   Dependencies:  #11224, #8327,     |       Commit:
  #10193, #12895, #14516, #14722,    |  8eaf51a82c4e2194769db13457979ae601ebbc04
  #13589, #14471, #15069, #15094,    |     Stopgaps:
  #11688, #13394, #15150, #15506     |
-------------------------------------+-------------------------------------

Comment (by SimonKing):

 Replying to [comment:263 nbruin]:
 > Replying to [comment:261 SimonKing]:
 > > No, it is not a memory leak. The stored items are formed by classes
 that are defined in modules anyway.
 >
 > Not for things that get fed to it for which it's designed. Does it
 always raise an error if it gets something else? It could leak that. So
 (especially when you scribbe in the cache beforehand) you'll have to
 ensure that the cache is cleansed of undesirable things.

 That's what I do in the "finally" clause (which is never executed, as can
 be seen by the absence of the warning message when starting Sage).

 > Basically, the whole use of `base_category_class_and_axiom` is
 questionable. Categories shoud just define a `_base_category_and_axiom`
 attribute outright.

 +1, because this would avoid headache.

 -1, because this is what one would have to do in an abundance of
 categories. This may even include (in the future?) categories that are
 dynamically created.

 Note that in addition to the lazy attribute,
 `CategoryWithAxiom.__classget__` overrides
 `cls._base_category_class_and_axiom`. So, why is there this lazy class
 attribute?

 I am not sure yet if I come to the same conclusions as you do. But I agree
 that the relationship of these three things
 - a lazy class attribute,
 - a `__classget__` that as a side effect overrides the lazy class
 attribute, and
 - a cached function that calls the `__classget__` while it is computing
 stuff for the lazy class attribute
 should be straightened.

 > As far as `base_category_class_and_axiom` is concerned, the value is a
 function of only their name anyway. It's just a tool to save (a small
 amount of) typing, and as we're seeing, causing nasty problems while
 trying to do it.

 Yes, for what we want to compute, it would be enough to let the input be
 `cls.__name__`.

 But no, ''if'' we want to make consistency checks (and in the current
 implementation we do want consistency checks), then we need to input the
 class.

--
Ticket URL: <http://trac.sagemath.org/ticket/10963#comment:265>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to