-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
RFC: Rename Associative
to AbstractDict
#25012
Conversation
From math background, I always thought |
I was uncomfortable with the unclarity that an |
Oh, for the record, there isn't a prototypical concrete |
I really like @rfourquet’s suggestion, which would allow the type hierarchy in DataStructures.jl to be filled out properly. Right now, neither |
Yes, having an However, I'd point out that (a) adding an immediate supertype to
lol, my bad. |
I'm fine with either renaming |
1e84614
to
9aa96b9
Compare
Can I request that triage please discuss whether to include My point of view is that adding things with no concrete types (or even defined interface) is not going to be helpful to many people, and that adding a supertype in later when we know exactly how that helps would be a better approach. A deprecation in v0.7 marks a fresh start - my worry is that without this, there may be code out there that expects e.g. unique keys from |
Doing a simple rename for now is the better approach. I am a one-man triage team 👅 |
9aa96b9
to
89d788d
Compare
I mentioned this at the "API consistency review" issue #20402 (comment). I wanted to see how this one would play out - it wasn't too hard in the end.
Some of the reasons I think this is worthwhile:
AbstractArray
,AbstractSet
,AbstractRange
andAbstractString
with prototypical concrete typesArray
,Set
,,Range
String
. It seems consistent to also haveAbstractDict
andDict
. EDIT:Range
was recently renamedAbstractRange
, in the name of consistency.Associative
is a bit of a unique case - all concrete implementations are namedDict
,SortedDict
,WeakKeyDict
- and I haven't seen aSortedAssociative
orImmutableAssociative
in the wild (someone please correct me if I'm wrong).Foo
toAbstractFoo
and back again. They should be able to guess that aDict
is anAbstractDict
, when they first come acrossAbstractDict
in a function signature. They will have one less word to learn!Associative
was. It's quite possible that many new users with a non-computer-science background don't recognize the term "associative array" (I hadn't, before Julia - I did know of maps, dictionaries, hash tables... even "a functional relation of two-tuples"... so I wasn't completely naive).Associative
is an adjective. Types in Julia are usually nouns. (OK, OK, but we have had bikesheddings over less). The wordAssociation
(used by at least Mathematica) would be seem more correct thanAssociative
(though I wouldn't recommend that change overAbstractDict
).(Apart from the bikeshedding issues, this also implicitly touches on some dicussions about the "meaning" of
Associative
collections, because generally ourAbstractFoo
/Foo
pairs behave quite similarly. In particular, refer to comments like this and the second point in this (the basic summary is: should theAssociative
interface allow or disallow multi-maps, etc, which are a generalized kind of associative container - my position is that it is very useful to know that the "dictionary" interface guarantees that the keys appear only once in the collection, and that other abstract types or data structures could and should be used to model multi-maps instead))The changes in this PR are purely cosmetic (no change in functionality).