justified-variables icon indicating copy to clipboard operation
justified-variables copied to clipboard

A request for start/end replacement

Open jyuhuan opened this issue 8 years ago • 12 comments

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.

jyuhuan avatar Jul 04 '16 20:07 jyuhuan

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!

timvieira avatar Jul 05 '16 15:07 timvieira

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.

mjpost avatar Jun 04 '17 21:06 mjpost

Sure, but eeeeeewwwwwwwwwwwww!

timvieira avatar Jun 09 '17 18:06 timvieira

Sometimes I use began and ended for this

kputnam avatar Jan 05 '18 20:01 kputnam

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

timvieira avatar Apr 09 '18 14:04 timvieira

Another good one, which was already on the list:

start -> originate
end   -> terminate

timvieira avatar Apr 09 '18 21:04 timvieira

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

pbloem avatar Mar 30 '19 08:03 pbloem

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)

pbloem avatar Mar 30 '19 09:03 pbloem

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 avatar Mar 31 '19 13:03 timvieira

New developments

commence
complete

timvieira avatar Feb 10 '21 13:02 timvieira

See also 61ca5070 (#31).

begin
belay

chambln avatar Mar 07 '21 18:03 chambln

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)]

aravindet avatar Jul 28 '21 14:07 aravindet