Just recording a bit of my learning the internals of Roassal, since it helps me flesh out my understanding. [ROShape>>removeShape:] does not have a test to reference for my understanding of this, but it appears to not work as expected. For example in workspace... b := ROBox new. c := ROCircle new. b addLast: c. b removeShape: ROCircle. b inspect
removeShape: works as expected I believe. I guess the problem is a matter of naming. The method ROShape>>removeShape: is actually an helper method and it is not meant to be directly called. Look at the method: -=-=-=-=-=-=-=-=-=-=-=-= ROElement>>removeShape: aShapeClass "Remove a shape of the element"
shape := shape removeShape: aShapeClass -=-=-=-=-=-=-=-=-=-=-=-=
Again, I use the Null Object design pattern. I wanted to loop here on the list of shape and doing a if-statement.
Actually, ROShape>>removeShape: aShape does not remove a shape, it simply return a collection of shapes without aShape. What a better method name could be? #shapesWithout: or #shapeChainWithout: ?
results in a linked list of: aROBoxShape --> aROCircleShape --> aROChildrenShape. Actually the semantics of [removeShape:] seem problematic. What should be the result of... b := ROBox new. b removeShape: ROBox. b inspect.
The method #removeShape: has indeed a very bad name. It suggests a side effect, but none is actually realized.
I would guess that 'b' should hold aROChildrenShape, except you can't change the value of 'b' from inside the [removeShape:] method. (In my limited knowledge of 'slots', I wonder if this is something they might help with.) I am relying on the guess that you could have aROChildrenShape as the only shape on an element, for subviews without a border, but could you clarify this. Naively I thought to just try... removeShape: aShapeClass ^ (self isKindOf: aShapeClass) ifTrue: [ next become: next next ] ifFalse: [ next removeShape: aShapeClass ]
but the danger of #become hit me and locked my image.
btw, something else just while I am feeling evil, what should happen with the following... b := ROBox new. b removeShape: ROChildrenShape. b inspect.
I guess my answer given above should clear up the things...
Alexandre