関連 https://en.wikipedia.org/wiki/Interval_(mathematics)
ある数値範囲 [0,90)の0,90の値を保持する変数名の検討。
@ Readable Code (Kindle Edition @ No.1151)
Prefer begin and end for Inclusive/Exclusive Ranges
a | b | c | d | |
---|---|---|---|---|
begin | end |
上記のような例で使われているが以下のようにも記載している。
But the word end is a little ambiguous. For example, in the sentence, "I'm at the end of the book," the "end" is inclusive.
endを使うと数年後にソースリーディングしにくくなりそうだ。
Fortran
不等号に使うものがある
参考 http://www.math.hawaii.edu/~hile/fortran/fort2.htm
- .ge.
- greater than or equal to
- .lt.
- less than
個人的にはge,ltでわかるが、Fortranを使わない人にはわからない。
アイデア
以下だとソース内で意味がわかりやすい
- min_inclusive / max_exclusive
とりあえずこれで作りながらもう少しよい名前を検討する