On Monday, December 3, 2018 at 2:46:50 AM UTC-8, Jeroen Demeyer wrote: > > It's not clear to me why this double weak reference is needed, but maybe > I'm missing something. It seems more logical to use strong references in > the coercion map but then store a weak reference to the map. > > The weak reference for the domain on coercion maps was introduced to accommodate coercion maps into longer-lived codomains. Coercion maps are generally cached on the codomain, because generally the codomain is constructed from the domain and hence shorter lived (the codomain generally references the domain anyway). This is not the case when mapping number fields into, say Qbar or RR. Then it may well be the case that the domain needs to be collected before the codomain. In order to make that possible, the coercion map (referenced strongly on the codomain -- it needs to be strongly referenced somewhere to keep it alive) must not hold a strong ref to the domain.
> I'd like to "fix" this with action maps first, which are conceptually > simpler. > > > Jeroen. > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.