Right now the collection libraries (in minigrace) insist that both the lower and upper bounds of ranges be integers, and raise exceptions otherwise. This behaviour is documented.
Other alternatives are possible, as @KimBruce mentioned in gracelang/minigrace#168.
For example, range.from 1.5 to 5.5 could be sequence [1.5, 2.5, 3.5, 4.5, 5.5]. Or we could round non-integers. Or we could floor non-integers. Or we could ceiling non-integers. Or we could ceiling the lower bound and floor the upper bound, or vice versa. Indeed, the variations are almost endless, which is probably why I chose to raise an exception.
Should we change the current behaviour? If so, to what?
Right now the collection libraries (in minigrace) insist that both the lower and upper bounds of ranges be integers, and raise exceptions otherwise. This behaviour is documented.
Other alternatives are possible, as @KimBruce mentioned in gracelang/minigrace#168. For example,
range.from 1.5 to 5.5
could besequence [1.5, 2.5, 3.5, 4.5, 5.5]
. Or we could round non-integers. Or we could floor non-integers. Or we could ceiling non-integers. Or we could ceiling the lower bound and floor the upper bound, or vice versa. Indeed, the variations are almost endless, which is probably why I chose to raise an exception.Should we change the current behaviour? If so, to what?