Some thought's about the Interval discussion:
Squeak and Smalltalk in general mixes mathematical intervals and numerical orders in the Interval class:
If we use
(1 to: 20) we expect to get an interval with a beginning and an end. We can ask this interval if it includes a number. It should return true if this number is inside the interval. Example: (1 to: 20) includes: 0.9 -> false (1 to: 20) includes: 1 -> true
(1 to: 20) includes: 1.1 -> true The interval by itself is continuous. [----] Maybe we should also think about open intervals with infinite beginning or end. [--[ (1 to: oo) includes: 100 factorial -> true oo stands for infinite sign.
(1 to: 20 by: 3) means we want to have a collection of numbers like the following: (1,4,7,...,19). The method Integer>>to:by: should therefore return an array, an instance of a new class called NumericalOrder or whatever. As mathematician we would'nt expect an interval as return value, would we.
As Smalltalker we would expect an Interval, because we know of the Integer>>to:by: implementation.
I've asked some non-smalltalkers about that with the result that people wouldn't expect an interval, because an interval has only a beginning and an end and is continuous. (They also expect the result of 3+4*7 as 31 ;)
The only reason for returning an interval is that Smalltalk can safe a lot of memory if it stores only the beginning, the end and an increment. So you can easily iterate through a huge collection of numbers. (1 to: 4000 by: 3) do: [...]
-Torsten
squeak-dev@lists.squeakfoundation.org