#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 jdemeyer):
Replying to [comment:16 vbraun]:
> Still if we agree that it can't be done safely then maybe it's a bad
idea?
What do the two "it"s refer to in this sentence?
Fixing cached functions can be done safely. We already pre-process
arguments to cached functions in `src/sage/misc/function_mangling.pyx`, so
it's not hard to also dereference lazy imports there. Of course this does
not fix every single use-case of lazy imports, but this is still an
important use-case.
Automatically "fixing" lazy imports in `globals()`-like dicts can be done,
but there the hard problem is to determine which dicts should be
processed.
> An alternative might be to have a proxy object that, instead of trying
to look like the original object, relies on the preparser to replace it?
E.g. the preparser replaces `NN` with `NonNegativeIntegerSemiring()`.
I'm not convinced that we want to involve the preparser for this. What if
somebody writes
{{{
sage: NN = some_completely_unrelated_object
sage: f(NN)
}}}
you don't want this to be replaced by
{{{
sage: NonNegativeIntegerSemiring() = some_completely_unrelated_object
sage: f(NonNegativeIntegerSemiring())
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/19628#comment:18>
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.