#16353: A cached_function with selective memory
-------------------------+-------------------------------------------------
       Reporter:         |        Owner:
  ncohen                 |       Status:  needs_review
           Type:         |    Milestone:  sage-6.3
  enhancement            |   Resolution:
       Priority:  major  |    Merged in:
      Component:         |    Reviewers:
  performance            |  Work issues:
       Keywords:         |       Commit:
        Authors:         |  7eb8f900f1a143c6cc85b9382a365b57a9c42ecc
  Nathann Cohen          |     Stopgaps:
Report Upstream:  N/A    |
         Branch:         |
  u/ncohen/16353         |
   Dependencies:         |
-------------------------+-------------------------------------------------

Comment (by ncohen):

 > How can you tell from the input parameters whether the caller is going
 to mutate the result you're returning?

 `O_O`

 It is simple :

 1) If I can use the feature implemented in this branch

 --> I can only cache the return values I am interested in caching (they
 are boolean-->immutable) and I can return other values as immutable types,
 which is their most natural type.

 2) If I cannot use the feature implemented in this branch, I have to use
 cached_method

 --> Thus I have to cache everything that my function returns, and so I
 cannot return immutables types anymore. And I have to return tuples of
 tuples instead of lists, which complicated matters uselessly.

 > Surely a non-internal routine will have uniform input/output
 specifications, i.e., always return either mutable types or immutable
 types?

 No. My function returns booleans or lists of lists, depending on what the
 user asks. If I have to make it tuples of tuples and cache them for
 naught, it's a waste for everybody.

 With this branch, I can cache only what I want and not have to change what
 my function returns to fit the cached_method's needs.

 Nathann

--
Ticket URL: <http://trac.sagemath.org/ticket/16353#comment:39>
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/d/optout.

Reply via email to