[squeak-dev] Strange Behavior Variance between Form and Cursor

JohnReed Maffeo aldeveron at graffiti.net
Sat Aug 18 20:41:54 UTC 2012


Cursor is a subclass of Form but their extent:fromArray:offset methods produce significantly different results.

In a workspace, I inspect two instances

Cursor extent: 16 at 16 fromArray: #(65535 2047 30975 32575 32735 32751 32759 32759 32763 32763 32763 32765 32765 32765 32765 1) offset: 0 at 0

Form extent: 16 at 16 fromArray: #(65535 2047 30975 32575 32735 32751 32759 32759 32763 32763 32763 32765 32765 32765 32765 1) offset: 0 at 0

In the inspector browser in each, I do "self displayOn: Display"

The cursor instance displays an Arc icon in the upper left hand corner of the Display.
The cursor instance displays a white box icon in the upper left hand corner of the Display.

The difference appears to be the fact the the Cursor method applies a bitShift: 16 to the elements of the input array.

I have observed these results in the Squeak4.2-10966 and the minimal-MVC (nee Squeak3.8.18beta3u ?).

It seems to violate the principle of least astonishment. Is it a bug, a feature or an interesting artifact?

This was discovered while I was doing some work trying to port and old Smalltalk-80 graphics application as part of my self study process.

I can get the results I am looking for by doing this:

Form extent: 16 at 16
 fromArray:  (#(65535 2047 30975 32575 32735 32751 32759 32759 32763 32763 32763 32765 32765 32765 32765 1)
collect: [ :each | each bitShift: 16]) offset: 0 at 0

Regards,

John-Reed


More information about the Squeak-dev mailing list