Who wants full block closures and why?
Benoit St-Jean
lamneth at aei.ca
Sat Jul 17 20:16:47 UTC 1999
At 15:54 99-07-17 -0400, you wrote:
>Non-cute example:
>
>| blockArray dataArray |
>blockArray := Array new: 5.
>dataArray := #( 'Apple' 'Orange' 'Grape' 'Lemon' 'Kiwi').
>1 to: blockArray size do: [ :index |
> blockArray
> at: index
> put: [ dataArray at: index ] ].
>^ (blockArray at: 2) value
I got curious about that code and tried it on several Smalltalk versions.
Here are the results:
Dolphin : Subscript out of bounds error (Array>>at:)
Smalltalk Express : primitive fails in Arrat>>at:
VSE 3.1 : anwers 'Orange'
VisualWorks 2.5.1 : answers 'Orange'
VisualWorks Non-Commercial 3.0 : answers 'Orange'
VisualWorks Beta 5i : raises a SubscriptOutOfBoundsSignal in Core::Array>>at:
VisualAge for Smalltalk 4.5 : answers 'Kiwi'
Who's right? :)
What's is the ANSI draft saying about such a case?
____________________________________________________________________________
Benoit St-Jean Creative Technologies International
871-8585 #234 1440 Ste-Catherine ouest, Bureau 400
email (work) : bstjean at creative.ca Montreal, Quebec, Canada, H3C 3R7
(home) : lamneth at aei.ca
The opinions expressed in this message are my own personal views and do not
reflect the official views of CTI
More information about the Squeak-dev
mailing list
|