-
Notifications
You must be signed in to change notification settings - Fork 32
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
is_last naming bikeshed #129
Comments
Hi, thanks for filing the issue! As it happens, I was thinking about this as well after I saw that Reddit thread. In my defence, the name Back when I started working on the library, cursors were called indices and the sequence functions were called Of the names you suggest (thank you for coming up with a list!), I think we actually could use I'd be keen to get more feedback on this before changing anything so if anyone has any suggestions or preferences then please leave a comment! |
Yeah, thinking in terms of possible valid index values,
True, it's a contextual keyword. 🤔
Certainly, leaving it open a while for further comments is wise. Thanks for listening. ⏳👂... |
I had similar thoughts while watching that talk.
|
"Did we find what we were looking for or did we reach the end of our search range" isn't all that crazy IMO. And in any case, Flux has
If you use closed rather than half-open ranges then it means you can't call |
sigh |
Python uses start and stop for half-open index ranges (as well as other things, though not 100% consistently), and I remember it being much more immediately clear on first sight compared to C++'s begin and end, to the inexperienced programmer that I was at the time. I also do think that it helps to use two words that are a natural pair in English. Just came to this repo from your wonderfully presented CppNorth talk. |
Rewatching your CppCon talk tonight (Iteration Revisited: A Safer Iteration Model for Cpp - Tristan Brindle) reminded me of this issue. Is half a year enough time for feedback collection? :b |
After more than a year since this issue was filed, it's probably time for an update! As part of some wider changes to the Flux concepts, I'm planning to change the names of some of the accessor functions. The proposed new names are as follows:
In particular, the last change means that we can provide a safe, bounds checked If anyone feels very strongly that these new names are terrible and I'd be making a big mistake in changing them, please let me know! :) |
I like the reversed the naming of the |
Is the (feel free to close at your discretion once you feel any other folks' feedback is addressed) |
These can be member functions as well, so we need to differentiate |
I came here from your recent talk "A Safer Iteration Model for C++ - Tristan Brindle - C++ on Sea 2023", and generally I like it. 😎
The naming of
is_last
though is confusing because it's not testing whether the current points to the last thing, but rather whether it points after the last thing. The namefirst
is fine for the starting point, but for the stopping point, you really want to know whether the cursor is at the limit (like limits in math, an element one past which is not actually ever reached). I considered possible alternate names 🤔:is_limit
(not too long and very clear, that you'reat
thelimit
)is_past
(coincidentally rhymes withis_last
for the one-past 😉)is_done
(works, but then it's counterpartflux::done()
counterpart doesn't sound so nice)is_stopped
(would use pairsflux::start()
andflux::stop()
, which sounds a bit weird, but not weirder than begin/end)is_complete
(hmm, maybe)is_terminated
(bit long)is_terminal
(maybe)(oops, C++ keyword, so can't use that)is_final
And conversely for the counterpart of
flux::first(v)
:flux::limit(v)
(noun works well here)flux::past(v)
(clearly evokes the "one past" concept)flux::done(v)
(😕 hmm, sounds weird because it sounds like a boolean function rather than returning a one-past sentinel marker)flux::stop(v)
(can be a noun like "gradient stop" or a verb, where verb is weird like "end")flux::complete(v)
(😕 also sounds like weird like done)flux::terminal(v)
(but not to be confused with a command line interface 😅)(oops, C++ keyword, so can't use that)flux::final(v)
And yes, using any of the above counterparts above would not form a pair like
first
andlast
do, but then end-exclusive ranges are already an asymmetric concept[ )
.From your talk, where you say "That's called chain in my library, because that's a better name" and "sum, because that's easier to spell than accumulate", I can see you're not strongly attached to existing names. Do any of the above alternate names convey the concept for you nicely, especially
limit
orpast
, because if the 62 upvotes from here mean anything, usinglast
is an non-ideal name? Cheers from Seattle.The text was updated successfully, but these errors were encountered: