(This is difficult to search for, so I thought I should ask the question.) I see this warning:
.nim(101, 23) Warning: < is deprecated [Deprecated]
base*: array[0 .. <MSA_BASE_GROUP_LEN, align_tag_col_t] # array of length 5
^
However, if I try to fix it:
foo.nim(101, 20) Error: ordinal type expected
base*: array[0..<MSA_BASE_GROUP_LEN, align_tag_col_t] # array of length 5
^
Should I simply subtract 1 now?
Be aware of Djikstra's opinion on ranges: https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html
Use this:
array[MSA_BASE_GROUP_LEN, align_tag_col_t]
Be aware of Djikstra's opinion on ranges: > https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html
Oh not that again. Exclusive ranges ONLY work when you have a sentinel value that shouldn't be included. That's generally not the case in programming and the whole article falls apart.
Fortunately, array[n, int] is 0-based, so that will work fine for me in this case.
I would not be happy with array[0 .. (n-1), int].
(Not to mention that most people prefer 'A'..'Z' over 'A'..<'Z'+1.)
I prefer range(26, 'A'). When you provide both length and start-point, there is never ambiguity. This is something Python, Perl, and Ruby all got wrong. And .. versus ... is hard to remember.
Also in Python, think how you would represent a backwards range, starting from last element. [-1:0:-1] is wrong, and [-1:-3:-1] doesn't work either. But at least reversed() works well. range(-26, 'Z') or range(26, 'A', -1) are both better than Python ranges.
Oh not that again.
LOL. The only reason I'm asking at all is that, returning to Nim after a few months, I find the language substantially different. I remember learning to use ..< instead of .. < -- seems like only yesterday.
Looking forward to 1.0!