#19628: lazy_import breaks CachedRepresentation
----------------------------+-------------------------
       Reporter:  cheuberg  |        Owner:
           Type:  defect    |       Status:  new
       Priority:  major     |    Milestone:  sage-6.10
      Component:  coercion  |   Resolution:
       Keywords:            |    Merged in:
        Authors:            |    Reviewers:
Report Upstream:  N/A       |  Work issues:
         Branch:            |       Commit:
   Dependencies:            |     Stopgaps:
----------------------------+-------------------------

Comment (by nbruin):

 Replying to [comment:28 jdemeyer]:
 > Are you thinking of `ma_lookup()`? That ''could'' work, but I agree that
 it would be a major hack.

 That would be one hook. But there's more.
 {{{
 sage: lazy_import("sage.rings.integer_ring","ZZ")
 sage: id(ZZ)
 140457737914168
 sage: ZZ
 Integer Ring
 sage: id(ZZ)
 140458433423744
 }}}
 Note that the user didn't rebind ZZ and yet its identity has changed. That
 can affect all kinds of things. You'd basically need `LazyImport` to be
 transparent for being put into argument lists as well. And that's just
 horrible (and undebuggable!). I think it would be a major maintainability
 penalty to try and support that kind of stuff, for relatively little gain.
 I would say the minor inconvenience for users that objects supported by
 code that is lazily imported cannot be available straight away in the top
 namespace is preferable.

 But perhaps your experiments end up indicating something else.

--
Ticket URL: <http://trac.sagemath.org/ticket/19628#comment:29>
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