#14159: Don't install callbacks on values of TripleDict, MonoDict
---------------------------------+------------------------------------------
Reporter: nbruin | Owner: tbd
Type: PLEASE CHANGE | Status: new
Priority: major | Milestone: sage-5.8
Component: PLEASE CHANGE | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
---------------------------------+------------------------------------------
Comment (by nbruin):
Replying to [comment:1 SimonKing]:
> 2. If an existing entry is overwritten by `__setitem__` then its
callback will be removed.
I guess you could reach into the `KeyedRef` object and invalidate the key
to prevent action on callback. Doing so would complicate all our dict
setting and deleting, so I think that is not an attractive option.
Just deleting the `KeyedRef` object won't guarantee it will go away:
someone else may be holding a reference to the `KeyedRef` object as well.
So probably there needs to be an additional option on `...DictEraser`
objects to check that the value is as expected (or write yet another
callback class, but that sounds like a waste).
And then `...Dict` would grow an extra `set_weak_value` to install the
appropriate KeyedRef on the value, because letting other code instantiate
eraser objects is scary.
It feels like horrible feature creep, but I guess you have a good use case
(can you come up with an alternative solution?)
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14159#comment:2>
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.