I have artistic content, developed in Squeak, published as .image files,
which I preserve and move to other images (e.g. newer versions of Squeak)
by saving as .morph and loading the morphs back in new images. Lately I
have been loading into Squeak 5.3 .morphs from Squeak 4.3 and getting very
strange results where borderWidth shows as 1 in Squeak 5.3 but instance
variable borderWidth is 0 -- in Squeak 4.3 borderWidth shows as 0, as
intended. It's taken me a while to figure this out, but I think I have it
nailed down. I can fix the problem easily enough in my own content, but
whether Squeak should be "fixed" is not clear; I would hate for a "fix" to
break somebody else's content.
The "root problem" here seems to be that a morph's borderWidth is at least
in some circumstances being stored in *two places*:
1. ("The obvious"): Morph instance variable borderWidth.
2. ("The obscure"): Morph instance variable extension instance variable
otherProperties at: #borderStyle instance variable width.
What happens when they disagree?
As of Squeak 4.3, a morph with borderWidth 0 and borderStyle width 1 will
show as if both are 0; as of Squeak 5.3 (and continuing to 6.0) such a
morph will show as if both are 1.
The code I am using to "fix" my own content looks like this:
self allMorphs do: [ :m |
m valueOfProperty: #borderStyle ifPresentDo: [ :s |
(m borderWidth = s width) ifFalse: [
s width: m borderWidth
]
]
]
I.e.: setting borderStyle width to be the same as borderWidth works for
me, but I have no way of knowing whether it will break somebody else's
stuff. In my opinion having the borderWidth in two places is not a good
idea, but may be necessary for somebody's backward compatibility.
Comments?