Intervals

Michael Donegan invader at zilker.net
Tue Nov 30 20:04:00 UTC 1999


>Aren't floats fun!  :-)
>

No kidding. The introduction of floats causes a problem because there is no
unified notion of float comparison in Smalltalk. We might decide, e.g. to
use the closeTo: method to determine whether values were in the interval.
But, that wouldn't always work as Dave shows. It is clear that at least one
author assumed that Intervals had integer values only (see the source for
setFrom:to:by:). The only general solution would be to include the fuzz or
epsilon value with an instance and defaulting it to some class variable.
But there are other instances of comparison (like closeTo: and maybe
others) that would not be helped by this solution.

A more complicated, but someone better solution would be to have multiple
subclasses of Interval depending on the three values. I think someone else
already suggested that.

	mkd





More information about the Squeak-dev mailing list