GithubHelp home page GithubHelp logo

Change name? about indexmap HOT 36 CLOSED

igouy avatar igouy commented on June 25, 2024
Change name?

from indexmap.

Comments (36)

bluss avatar bluss commented on June 25, 2024 4

Thanks a lot for being part of the process, IndexMap it is! And thanks @cuviper that you want to help out!

from indexmap.

clarfonthey avatar clarfonthey commented on June 25, 2024 3

LinearMap implies linear access time, so, no go for that. I'd personally prefer OrderedHashMap or something similar.

from indexmap.

cuviper avatar cuviper commented on June 25, 2024 3

The reason to rename is so an always-ordered crate can assume the name OrderMap?

My next preference is IndexMap, since indexing is such a powerful property here.

from indexmap.

arthurprs avatar arthurprs commented on June 25, 2024 3

While I get the motivation, IndexMap still feels way better than SteadyMap (which is essentially arbitrary).

from indexmap.

cuviper avatar cuviper commented on June 25, 2024 1

(it wasn't my name, I just picked it from #14 (comment))

from indexmap.

bluss avatar bluss commented on June 25, 2024 1

From discussion in #rust, came the idea that clear docs would be even better than the perfect name.

No name can be so specific that it has the full picture in just the name. I might propose SteadyMap instead. With a unique name we can make the meaning clear in docs.

from indexmap.

bluss avatar bluss commented on June 25, 2024

Maybe. The main feature is that it has a consistent (iteration) order that does not depend on the keys or the hash function.

from indexmap.

bluss avatar bluss commented on June 25, 2024

Note that for clarity reasons it did already change name from OrderedMap to OrderMap

from indexmap.

igouy avatar igouy commented on June 25, 2024

What would you call the "separately named hash map" if this one is still called OrderMap ?

from indexmap.

bluss avatar bluss commented on June 25, 2024

Renaming the crate seems prudent; the name is the first impression we have, and there we need to deliver the correct expectations about what the data structure does.

NOTE: This is the name for the datastructure in this crate in its current implementation. current OrderMap will change name.

The datastructure is a hash table, stored in a compact indexable range, where it keeps insertion order as long as you don't call .remove().

Name Alternatives:

  1. LinearMap
  2. SequenceMap
  3. IndexMap

I prefer LinearMap because its succinct, vaguely reminds one of the compactly indexable "Like a Vec" ordering semantics.

Thoughts and wo-hoos are welcome. Please leave well thought out alternative names too. Migration will use deprecation with clear message to point to the new crate name, and there will be a migratory crate version that is 100% API compatible with the other.

from indexmap.

bluss avatar bluss commented on June 25, 2024

Thoughts on new name from @nox @cuviper @igouy @Techcable @pczarn @arthurprs @Binero @garro95 and everyone else!?

from indexmap.

clarfonthey avatar clarfonthey commented on June 25, 2024

IMO: the name of the type can be succinct but the crate's name should be very precise.

from indexmap.

bluss avatar bluss commented on June 25, 2024

I'm not going for that meaning of "linear" here. We can describe a Vec as linear too, and it is constant time indexable; I think it can work.

from indexmap.

clarfonthey avatar clarfonthey commented on June 25, 2024

@bluss that would be fine, but linear-map is already a crate that does linear search. https://crates.io/crates/linear-map

from indexmap.

bluss avatar bluss commented on June 25, 2024

Aw, that's too bad.

from indexmap.

bluss avatar bluss commented on June 25, 2024

The reason is twofold. Most importantly now that ordermap seems to have delivered the wrong expectations. Secondly yes because I think a full insertion order map is important to Rust, to give the name to it.

from indexmap.

Binero avatar Binero commented on June 25, 2024

For what it's worth, I think @bluss's IndexMap is a pretty descriptive name.

from indexmap.

garro95 avatar garro95 commented on June 25, 2024

I like IndexMap too

from indexmap.

arthurprs avatar arthurprs commented on June 25, 2024

IndexMap sounds reasonable to me 😄

from indexmap.

Techcable avatar Techcable commented on June 25, 2024

Although I am nostalgic for OrderMap, I think it's okay to rename it to either SequenceMap or IndexMap.

from indexmap.

bluss avatar bluss commented on June 25, 2024

I appreciate the feedback!

Now 😄 I'm sorry to capture you like this (it's entirely voluntary), you who have already commented here or those that happen to read this: co-maintainers are also welcome since a good crate needs shared ownership. Maybe we don't have so much to do? The most important goal is just 1.0, and the name should be the only thing left blocking that..

from indexmap.

cuviper avatar cuviper commented on June 25, 2024

I'm willing to be a co-maintainer.

from indexmap.

bluss avatar bluss commented on June 25, 2024

cc @vitiral too, thoughts about the name?

@cuviper Awesome!

Other volunteers are also welcome to help out, of course.

from indexmap.

vitiral avatar vitiral commented on June 25, 2024

Some other names:

  • IterMap: to show it's performance when iterating
  • DetMap with crate name deterministic_map to show that iterating is deterministic (very important for tests).
  • IndexMap: already mentioned, I really like it. I think it gets to the root of what the crate does (... also note... I didn't actually realize indexing was supported in the public API -- cool!).

I think my vote is IndexMap but I thought I would spitball the others in case someone else has a real idea.

Also, I will be adding this to the ergo_std crate (not yet announced) in the ergo crate ecosystem as I think it should be considered a core type of ergonomic programming. So you chose a good time to rename!

from indexmap.

bluss avatar bluss commented on June 25, 2024

DeterministicMap is a good point, DetMap is not a very understandable shortening, but deterministic is right in the realm of names we have been shooting for (even SteadyMap).

Note that the current plan is a common release of version 0.4 of ordermap and indexmap that are API-identical (apart from deprecation in ordermap, and the addition of the renamed types in indexmap). Then shortly after that indexmap can be 1.0.

It sounds a bit convoluted but it each step along the plan is simple and actionable. Ideally there should be an indexmap 0.4 that is ready to be rubber stamped as 1.0 soon.

from indexmap.

vitiral avatar vitiral commented on June 25, 2024

Just so I understand:

  • The types currently in ordermap are moving to indexmap (or some other name) and being renamed accordingly.
  • There will be new types in ordermap that have some different functionality, i.e. always ordered or something.

Is that right?

from indexmap.

bluss avatar bluss commented on June 25, 2024

(It's basically right) The second point is a later concern, since no implementation exists, it will of course be a breaking version upgrade.

from indexmap.

nox avatar nox commented on June 25, 2024

I think DetMap is pretty good; even if reader is confused at the Det part for a few seconds, they'll see use deterministic_map::DetMap; somewhere.

from indexmap.

vitiral avatar vitiral commented on June 25, 2024

DetMap has the issue where it is not very deterministic when you do a remove, so I'm not sure it is actually the best name.

IndexMap kind of has this issue as well -- but then again if you remove a value from a Vec then the indexes of the other values move around, so that is probably fine. They don't move randomly like they do here, but that's probably okay as well...

from indexmap.

clarfonthey avatar clarfonthey commented on June 25, 2024

@vitrial this can easily be solved by renaming remove to swap_remove. It'd be clear what's happening then.

from indexmap.

Binero avatar Binero commented on June 25, 2024

@clarcharr remove is just a thin wrapper around swap_remove. I think if we're going with IndexMap, it's important to make remove behave like it would on a Vec. This would of course be terribly slow, but if performance is an issue, people can always switch over to swap_remove.

We could of course also remove it completely.

from indexmap.

bluss avatar bluss commented on June 25, 2024

I don't quite follow why remove() should change behaviour just because the data structure changes name. Maybe a different name is better then.

.remove() is a tricky knot in this case, there is an inconvenient half way solution — no remove method, but an extension trait that adds a .remove() method that wraps .swap_remove(). That makes dropping in ordermap in as a replacement of the standard HashMap one step more complicated.

from indexmap.

Binero avatar Binero commented on June 25, 2024

When I think of an IndexMap I think of a hybrid between a Vec and a HashMap. The functions have the same effect to the indices as a Vec would have, and the same effect to the keys as a HashMap would have.

In a HashMap, the remove function removes the key and the value from the collection. In a Vec it removes the element and shifts all following elements one position forwards.

So, in a IndexMap, it would be intuitive if a remove function would remove the key and value pair, and shift all following elements one position forwards.

The current remove function works like the remove function of a HashMap, but is nothing like the remove function of a Vec. Rather, it acts like the swap_remove function of a Vec.

from indexmap.

vitiral avatar vitiral commented on June 25, 2024

@Binero while I agree with you that is slightly more expected, it has significant performance penalties. In most cases the fact that removing an element can affect the index of other elements is enough.

I would go the opposite -- add a shift_remove which does what @Binero is suggesting and just make sure docs state the behavior of remove.

In the majority of cases I would expect the performance of remove to be equivalent to HashMap. The specific behavior is normally not important.

from indexmap.

Binero avatar Binero commented on June 25, 2024

In case we want to just focus on the fact the collection works like a HashMap which allows for fast iterating, where the indexing features are merely a side-effect of the way it is implemented (and thus not really part of the core-features), I think @vitiral's IterMap is more fitting.

I'm just not sure if we want such a narrow use-case for the collection while it could easily handle more.

from indexmap.

vitiral avatar vitiral commented on June 25, 2024

@Binero

In case we want to just focus on the fact the collection works like a HashMap which allows for fast iterating, where the indexing features are merely a side-effect

Something that is fast indexing is pretty much by definition fast at iterating, which is why I think IndexMap is probably the better name.

IterMap also has the problem that it sounds like the struct you get when you call IndexMap::iter() 😆

from indexmap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.