-
Notifications
You must be signed in to change notification settings - Fork 26
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
Bikeshedding "entries" #1
Comments
One possible suggestion: |
I personally find the "stack" analogy confusing since you can inspect more than just the top of the stack, and the current entry might not even be the top of the stack. (If you've gone back a bit.) But people keep using it, so maybe it's just me.... |
Yeah, I agree that the word "stack" is not the traditional data structure terminology. But I do think that for years that's what documentation about history has called it - and this carries over even into native navigation. |
* appHistory.currentEntry → appHistory.current * appHistory.updateCurrentEntry() → appHistory.update() * appHistory.pushNewEntry() → appHistory.push() * currententrychange event → currentchange event * event.upcomingEntry → event.upcoming * event.ongoingEntry → event.ongoing * event.destinationEntry → event.destination This helps with #1, although appHistory.entries remains.
* appHistory.currentEntry → appHistory.current * appHistory.updateCurrentEntry() → appHistory.update() * appHistory.pushNewEntry() → appHistory.push() * currententrychange event → currentchange event * event.upcomingEntry → event.upcoming * event.ongoingEntry → event.ongoing * event.destinationEntry → event.destination This helps with #1, although appHistory.entries remains.
I merged #35 which shortens everything in the way suggested in the OP. The question remains what to do with That is somewhat related to the discussions in #7, as once we introduce a "slot key", it might be better to make the whole thing maplike---i.e. have keys(), entries(), values(). |
This isn't the most important issue out there, but I'd still kind of like to resolve it, especially after the rename in #92. Now we have an Options:
My instinct is toward (2), but I'm open to other opinions. |
I like 4 since it follows established patterns and provides a lot of functionality that would be harder to replicate with the other options. |
The fourth seems most natural/intuitive to me. I was under the impression that (OTOH, I don’t think any of these options would specifically be “bad”.) * These are also the ones that get the "FooIterator Prototype" objects that no two browsers seem to implement the same way currently. At least in theory, maplikes just use %Map.prototype.entries% I think, though maybe that’s a recent change or something cause neither Chrome or FF seems to do it. |
Regarding the “entry” term itself, I’m probably biased by familiarity, but it doesn’t strike me as being awkward or ambiguous in general. The trouble seems very specific to having an To me, If the goal is to choose a totally generic name, that name would seem to already be Of course, you could define |
Random access (without the extra Some of the readme examples have things like My main concern here is sacrificing mainline DX cases (random access, simple array method usage) in favor of some generic symmetry argument ("the platform has a lot of maplikes, maybe this should be one too"). So I'm not very interested in arguments like "it follows established patterns" or "seems most natural/intuitive". Instead I'd like to get a sense of the cost/benefit of the actual usage patterns. I.e.
To me this leans in favor of an array instead of a maplike, but I'm open to evidence that people would use the "pro-maplike" code patterns a lot and the "pro-array" coding patterns rarely. |
Iterator helpers seems like it’d address a lot of the DX gap from having an iterator over an array. |
I lean array instead of maplike. It feels to me that if you have a key, most of the time you already have the whole entry already as well, so the I prefer entries to items, since I think an AppHistoryEntry is an entry, not an item. But I would be open to other names like "stack" or something. |
This makes sense. When I said “seems most natural/intuitive to me” it wasn’t meant to constitute a supported argument for that solution. I was offering an “as a developer, I would probably be least surprised by...” data point because I’d (mis-)interpreted the enumerated options as a prompt for that kind of feedback. The rest of that comment was more specific, and not related to how many maplikes do or don’t exist :) It pertains to the choice between 3 and 4 (i.e., if a key-value collection is used, whether it would be option 3 or option 4). As far as I can tell, |
#9 (comment) is leaning me away from maplike. |
Let's stick with |
Moved from slightlyoff/history_api#16 by @jakearchibald, but expanded by me.
An
appHistory.entries
property might be a bit confusing, since various "maplike" JS and web platform APIs haveentries()
/values()
/keys()
methods.At a more general level, although the idea of "history entry" has a long history in specs and implementations, it is not currently exposed to web developers. So there's no API consistency constraint that forces us to choose that term. We could use something else like "item".
Another route would be to avoid naming these things as much as possible, as suggested by @Yay295 in WICG/proposals#20 (comment). E.g. instead of
we could have
In that case we'd still have to figure out a name for what is currently
appHistory.entries
, but it becomes less important as it is surfaced in fewer places...The text was updated successfully, but these errors were encountered: