"nicolas cellier" ncellier@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?
Interesting. I agree with Bert that this should be considered a bug. Interestingly enough, I just found that VisualWorks 7.3 Dolphin 2.1 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:
at: anInteger
"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.
Enjoy, Boris