So, to my sense a behavior of Interval is overloaded.. it tries to be too many things at once: - be an interval in math sense (which is infinite set if used for Real numbers) - be a "collection" of numbers which you can enumerate (implies that it is finite).
to me, i would be much happier if we could have two different and non-intersecting entities: - Enumeration. This one indeed can be used as a collection. i.e. "give me all integer numbers lying between values A and B, count each C-th number" Like that, (1 to: 1.5 by: 1) is enumeration which contains a single element. and #last should be = 1 - Interval (Range). A pure interval in math sense: defines a Set of numbers lying between numbers A and B, inclusive, where A <= B. Not enumerable, therefore no 'step' variable, instead what it could have, is flags to indicate whether interval endpoints included into interval or not.. i.e. (a,b) vs [a,b] vs [a,b) vs (a,b]. Not supporting enumeration (no #do: , no #add: no #at: etc). You can, however intersect, merge or diff two intervals etc.. same operations which you doing on sets (but that would require another entity - interval set). And of course, you can test whether some number lies within given interval or not. The reason i started this topic is because some code were using 'range' for variables which holding intervals.. Now what you think is more appropriate protocol for something called 'range', this: x := range first y := range last or this: x := range start y := range end -- Best regards, Igor Stasenko.
