When I read that, I thought that errorNotIndexable would raise an Exception different from Error. But this is not the case and it means that people should write not so good tests by checking Error
instead of a concrete Exception.

[[[
MyExampleSetTest >> testIllegal
        self should: [ empty at: 5 ] raise: Error.
        self should: [ empty at: 5 put: #zork ] raise: Error
]]]
We even have a rule that states that we should not catch on Error


at: index
        "Primitive. Assumes receiver is indexable. Answer the value of an
        indexable element in the receiver. Fail if the argument index is not an
        Integer or is out of bounds. Essential. See Object documentation
whatIsAPrimitive. Read the class comment for a discussion about that the fact
        that the index can be a float."

        <primitive: 60>
        index isInteger ifTrue:
                [self class isVariable
                        ifTrue: [self errorSubscriptBounds: index]
                        ifFalse: [self errorNotIndexable]].
        index isNumber
                ifTrue: [^self at: index asInteger]
                ifFalse: [self errorNonIntegerIndex]

thoughts comments?

Reply via email to