#14711: Weak references in the coercion graph
-------------------------------------+-------------------------------------
Reporter: jpflori | Owner: davidloeffler
Type: defect | Status: needs_review
Priority: critical | Milestone: sage-5.13
Component: number fields | Resolution:
Keywords: memleak, number | Merged in:
field, QuadraticField | Reviewers:
Authors: Simon King | Work issues:
Report Upstream: N/A | Commit:
Branch: | 364b9856b28d7060e3ea9825144de66c8f11ca2a
u/SimonKing/ticket/14711 | Stopgaps:
Dependencies: |
-------------------------------------+-------------------------------------
Comment (by nbruin):
Replying to [comment:135 SimonKing]:
> ''IF'' this is a bug then it should be dealt with on a new ticket.
Agreed.
> Note, however, that `C` can not know about the embedding of `A` into
`C`, and not even about the mere existence of `A`.
Are you suggesting that `C.coerce_map_from(A)` already fails? If we follow
the
digraph model for coercion, then whether there's a path from A to C is a
property of the graph, not something the vertices "know" about. Perhaps
the
following more symmetrically formulated code (which does the same thing
anyway)
is more convincing:
{{{
sage: G=get_coercion_model()
sage: G.discover_coercion(A,C)
(Generic morphism ..., None)
sage: G.discover_coercion(B,A) #currently unweakened with your patch!
(Generic morphism ..., None)
sage: sage: G.discover_coercion(B,C)
None
}}}
> So, how could it possibly be aware of a coercion from `B` to `C` via
`A`?
> Hence, I am not sure if this qualifies as a bug or as a misuse.
Are you claiming that `register_embedding` is not supposed to add edges to
the
same graph as `register_coercion` does? I don't see how that would lead to
a
useful model.
> > This wasn't such a problem before, but since we are now tying lifetime
> > implications to how a coercion is registered, I think it now becomes
apparent.
> I don't quite follow this argument.
As the documentation of `register_embedding` shows, it was originally
considered
to be a rather non-essential component; just some coercion map that gets
"blessed" as a particularly canonical one, but doesn't actually has a
very different effect (in fact, as we see, really a more limited effect),
so
people would just have used `register_coercion` or (even more flexible)
`_coerce_map_from_`.
With less strong references, there is more reason to use
`register_embedding`:
it expresses that the domain should keep the codomain alive rather than
the
other way around; the kind of thing that wouldn't be expressed usefully
before
anyway.
--
Ticket URL: <http://trac.sagemath.org/ticket/14711#comment:136>
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.