justified-variables
justified-variables copied to clipboard
A request for start/end replacement
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.
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 weirderstart/finis)alpha/omega(sometimes associated with the beginning and the end)
I'll give it some more thought. Lemme know if you find anything!
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.
Sure, but eeeeeewwwwwwwwwwwww!
Sometimes I use began and ended for this
Oooh! I like began/ended. Thanks, @kputnam !
Another good one, which was already on the list:
start -> originate
end -> terminate
I tend to go for fr/to when I need short variable names (which is usually the case with indexing).
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)
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 😜
New developments
commence
complete
See also 61ca5070 (#31).
begin
belay
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)]