-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a new common base type, as replacement for IsCollection
?
#53
Comments
I guess the question is why IsCollection and IsMapping don't do what we need? It would be nice if the new filters had some relationship to these (we might also want something comparable but with multiset semantics) either as subfilters (specifying objects that satisfied some additional conventions introduced for the datastructures package) or as superfilters (so that it is possible to talk about the new structures and the existing ones in a uniform way for some simple objects. In any case I think you have to distinguish set, multiset and mapping semantics from the very beginning. |
One thing these would be nice for is to provide a hook for offering Iterators and Cursors in a uniform way. Iterators for sets and multi-sets we already have via Iterator and IteratorSorted we might also want IteratorInOrderOfInsertion. For map-type objects we probably want IteratorOfKeys and IteratorsOfKeysSorted ... Maybe values as well, but that opens up a couple of cans of worms about repetition and ordering. Cursors we don't have, but see for instance the Java library design. A cursor is a uniform interface to mutable ordered datastructures allowing for efficiently searching, interrupting and resuming the search, inserting or deleting the "current" object without having to redo the search, etc. |
@stevelinton the problem with Likewise, For a hashmap, one could of course also view it as an |
I think we should consider Therefore, do we just want a (horribly named) |
So perhaps we add a new filter, say Also, iterators definitely are something I want (see also e.g. #30 which mentions iterators on hashmaps) |
@ChrisJefferson I guess we are thinking in a similar direction, if one equates |
(BTW drawback of the |
I do think we need at least two base classes -- one for things with keys and values and one for things with just data. Within the data case you have to split pretty quickly into set and multiset semantics. We can then subsume IsListOrCollection into one of those. The question is what operations do we promise (and what if anything do we say about their performance and semantics). |
I've added a page on the wiki with some preliminary thoughts. |
We may wish to introduce a new common base filter for our data structures, e.g. IsDataStructure, although that is somewhat bland and generic.
The point of that would be that it could declare a few common operations and attributes, like
IsEmpty
andSize
, so that we don't need to useInstallOtherMethod
, but can useInstallMethod
. Also, there could be a default method forIsEmpty
which invokesSize
. Also, default methods forViewObj
,PrintObj
,ViewString
etc. -- for this, we just need a way to map representation filters to strings, e.g.IsHashMapRep
to"hash map"
.The text was updated successfully, but these errors were encountered: