On Sat, May 26, 2018 at 6:24 AM, Travis Scrimshaw <tsc...@ucdavis.edu> wrote: > MatrixGroups are immutable and their comparison is by checking the > generators (and not isomorphism), which are essentially the construction > parameters (in reality, they are the corresponding GAP group). For > permutation groups, the equality seems to be isomorphism. So there is no > problem for MatrixGroups being UniqueRepresentation in terms of behavior.
+1 in principle. Nils has said to me as well that UniqueRepresention (or even simply CachedRepresentation) is known for introducing memory leaks. I certainly believe that--one doesn't come to such a conclusion without hard-earned experience. But I'm skeptical that that's something inherent to its design that can't be overcome with correct use. Obviously it should not be used with classes that are not truly immutable. I think Sage could use a better way to keep track of and/or enforce immutability of classes (that is, instances of classes). For example, have some base class which can be used as a mix-in (or an ABC) that designates something as immutable, and disallow assigning any attributes to its dict that aren't also immutable (including of course support for all the common built-in types). Of course, getting something like that right is not completely trivial and would require a lot of overhaul. I'm just surprised that it isn't already something that is considered more systematically. > On Saturday, May 26, 2018 at 5:53:15 AM UTC+10, Nils Bruin wrote: >> >> >> >> On Friday, May 25, 2018 at 12:17:35 PM UTC-7, Simon King wrote: >>> >>> But they could still be CachedRepresentation. Then, if the same subgroup >>> is given by the same generators, it is identical, but if the same >>> subgroup is given by different generators, it is just equal but not >>> identical. >>> >> But before doing so, you would need to show that in common scenarios it >> produces a benefit. It has three significant draw-backs: >> - you'd slow down the creation of matrix groups in general, because >> you're requiring the system to first go and look if there already is an >> object like it. >> - because the object you get *may* be shared with other code, you're at >> the mercy of that other code to not mutate it. (and you have to behave >> yourself too) >> - it would likely introduce memory leaks (because it's the >> CachedRepresentation part of UniqueRepresentation that makes these leaks >> likely). >> > > -- > 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. -- 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.