CommandHistory class #forgetAllGrabCommandsFrom:

Tom Phoenix rootbeer at redcat.com
Mon Nov 5 19:50:25 UTC 2007


On 11/5/07, Rob Withers <reefedjib at yahoo.com> wrote:
> Tom, the original loop that was looping forever was the method
> #forgetAllGrabCommandsFrom:

>     | object |
>     object _ starter.
>     [
>         [0 == object] whileFalse: [
>             object isMorph ifTrue: [object removeProperty:
> #undoGrabCommand].
>             object _ object nextObject].
>         ] ifError: [:err :rcvr | "object is obsolete"
>             self forgetAllGrabCommandsFrom: object nextObject].

That's a botch, every way I look at it. There's no need of the
parameter, since everybody wants to start at the beginning. Somebody
didn't know they could send #allSubInstancesDo: to Morph, which would
do this much more efficiently and without the possible #become bug.
Somebody else(?) added the error trapping to deal with obsolete
objects, but they could have tested rcvr isObsolete and not risked
hiding a different error in the process.

Is there any justification for the way this is done currently in
CommandHistory class #forgetAllGrabCommandsFrom:, instead of something
like this?

  CommandHistory class>>forgetAllGrabCommands
    Morph allSubInstancesDo: [:m |
      m removeProperty: #undoGrabCommand ].

Cheers!

--Tom Phoenix



More information about the Squeak-dev mailing list