cl-containers
cl-containers copied to clipboard
Iterator dynamic class incorrectly determined
It seems that when determining the dynamic class of an iterator a nonsensical result is sometimes returned. This can be reproduced by loading cl-containers and evaluating:
(make-iterator '(1 2 3) :circular t :transform #'sqrt)
which returns an iterator of class CIRCULAR-ITERATOR-MIXIN-AND-TRANSFORMING-ITERATOR-MIXIN-AND-LIST-ITERATOR
And then evaluating
(make-iterator '(1 2 3) :circular t)
which also returns an iterator of class CIRCULAR-ITERATOR-MIXIN-AND-TRANSFORMING-ITERATOR-MIXIN-AND-LIST-ITERATOR
. Additionally, any attempt to use this iterator immediately errors because the transform function is nil.
This seems to be a result of the success criteria for find-existing-subclass being too weak. It simply finds any class that subclasses all supers, even if that class was defined to include other mixins that aren't in the list of supers.
I actually discovered this while working with the dynamic-classes package, but it's much easier to demonstrate incorrect behavior using cl-container. I'm not sure how to fix this, but if I manage to come up with a way I'll submit a pull request.