Skip to content
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

A request for start/end replacement #7

Open
jyuhuan opened this issue Jul 4, 2016 · 12 comments
Open

A request for start/end replacement #7

jyuhuan opened this issue Jul 4, 2016 · 12 comments

Comments

@jyuhuan
Copy link

jyuhuan commented Jul 4, 2016

This list is a cure to my variable naming OCD!

A word pair to replace start/end is not yet present. This pair is used a lot in NLP. For example, a Span class may have start and end positions. The fact that start is two characters longer than end can surely drive one crazy, and hence this request.

@timvieira
Copy link
Owner

Nice to meet you :-D I'm glad you're finding this project useful and that you're issuing requests!

I agree start/end is a terrible pair (as is start/stop, begin/end, left/right).

For a List class, head/last are common methods (maybe even tip/end).

For a Span class, I imagine that begin and end are integers with begin <= end. For numeric spans / intervals, I've used lo/hi, which conveys lo <= hi (similar options: min/max, lower/upper, a/b), but it doesn't read as nicely and begin/end or start/end.

Others

  • start/cease (similar, but weirder start/finis)
  • alpha/omega (sometimes associated with the beginning and the end)

I'll give it some more thought. Lemme know if you find anything!

@mjpost
Copy link
Collaborator

mjpost commented Jun 4, 2017

Another idea is to borrow a concept from bash shell and use the reverse of a word as the closing concept: so bash's if/if and case/esac become start/trats or begin/nigeb.

@timvieira
Copy link
Owner

Sure, but eeeeeewwwwwwwwwwwww!

@kputnam
Copy link
Contributor

kputnam commented Jan 5, 2018

Sometimes I use began and ended for this

@timvieira
Copy link
Owner

Oooh! I like began/ended. Thanks, @kputnam !

@timvieira
Copy link
Owner

Another good one, which was already on the list:

start -> originate
end   -> terminate

@pbloem
Copy link

pbloem commented Mar 30, 2019

I tend to go for fr/to when I need short variable names (which is usually the case with indexing).

@pbloem
Copy link

pbloem commented Mar 30, 2019

This one has some nice alliteration (do we actually want that? it kind of ruins your autocomplete):

first
final

It doesn't work for standard inclusive/exclusive index ranges, but that seems to be the case for most of these. For those you could use

in
ex

from
upto

including
excluding (already in the list)

@timvieira
Copy link
Owner

timvieira commented Mar 31, 2019

All of these are amazing!

first/final and from/upto definitely need to be added to this list!

in/ex is a close call; my hesitation is that they are very ambiguous. to/fr is also too ambiguous - if I were going to be that terse I'd just use letters a/b. I'm actually a huge fan of single-character variable names - just keep the function short/sweet/clear.

Alliteration is a bonus. It stengthens the pair, IMO! Auto-complete will catch up once it digests the justified-variables list 😜

@timvieira
Copy link
Owner

New developments

commence
complete

@chambln
Copy link
Contributor

chambln commented Mar 7, 2021

See also 61ca507 (#31).

begin
belay

@aravindet
Copy link
Contributor

aravindet commented Jul 28, 2021

Where past tenses are suitable, why not just:

started
stopped

I use these in database models (where they usually have a _at, _on or _by suffix). At 7 characters, they also align with:

created
updated
deleted
fetched/visited   [Rather than read (past tense)]

@timvieira timvieira reopened this Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants