Interval new feature
Boris.Gaertner at gmx.net
Mon Apr 30 05:28:31 UTC 2007
"nicolas cellier" <ncellier at ifrance.com> wrote:
> After reviewing some of Interval bugs, I discovered this one:
> (10 to: 12) at: 1.5.
> Will answer 10.5.
> So maybe this is not a bug but a funny undocumented feature.
> Anyone ever thought of using such feature?
I agree with Bert that this should be considered a bug.
Interestingly enough, I just found that
VisualAge for Smalltalk 6.0.2
all exhibit the same behaviour. (Note that these are not the
newest available versions. I did not check the newest
versions of these products).
The star among these Smalltalks is the IBM product, where
we find this method definition:
"Answer the type of Number occurring at the index in the receiver
specified by anInteger. Report an error if anInteger exceeds
the size of the receiver.
Fail if anInteger is not an Integer."
| result |
result := from + (anInteger - 1 * by).
by > 0
ifTrue: [(result between: from and: to) ifTrue: [^result]]
ifFalse: [(result between: to and: from) ifTrue: [^result]].
ExCLDTIndexOutOfRange signalWith: 1
The "Fail if anInteger is not an Integer" is simply not true.
More information about the Squeak-dev