I would expect 1:0 to give me an empty sequence
because (a) for all other natural numbers n,
1:n gives me a sequence of n numbers, and (b)
how else am I supposed to get an empty sequence?
Under your interpretation, (x to: y) would never
be empty.
This has absolutely nothing to do with C.
As I commented, every programming language I
know except S uses a default increment of +1
in counted loops, if it allows default increments
at all.�� Fortran, Algol 68, Pascal, PL/I, the
seq(1) command in Unix, Haskell, the `seq'
function in Erlang, between/3 in Prolog, OCaml,
F#, InterLISP-D, and so it goes.
Fortran is an interesting case, because Fortran 66
left DO label id = lower,upper
unspecified when lower > upper and several compilers
made such loops execute once, to the point where
programmer tended to think the standard required that,
but Fortran 77 nailed it down: NO iterations in that
case.
Here's a typical use of #to:do:
���� s := 0.
���� 1 to: a size do: [:i |
�������� a at: i put: (s := (a at: i) + s)].
Why would you think it a good idea for this
to crash if the array is empty?
Smalltalk being Smalltalk, nothing stops you adding
�� through: end do: aBlock
������ self to: end by: (end < self ifTrue: [-1] ifFalse: [1])
�������������������������������� do: aBlock.
to Integer if you really want to.
Oh, there's an ambiguity.�� Should
5 through 1 mean 5,4,3,2,1 or 1,2,3,4,5?
Both can be argued for.