On Jul 16, 2011, at 12:46 AM, Nadeem Abdul Hamid wrote:

> Ah, right. How about you keep the picture separate, and functions like 
> 'move', 'rotate', etc. add to a list in the sprite structure; when the sprite 
> structure is passed to the draw handler, the draw handler updates the picture 
> based on those new segments or whatever, and then clears them from the 
> sprite's list.

Wait: so now instead of "move" mutating the picture, "draw" is mutating the 
sprite?  Out of the frying pan into the fire....

> This way you don't have to conflate the sprite with the picture, nor do you 
> have to worry about efficiency w.r.t. redrawing the entire history of the 
> sprite movement every draw update. Tests for the 'tick' handler can be 
> written in a functional style since only the sprite structure is involved. ?

Not if the draw handler is mutating them behind the scenes.  I could have two 
sprites that look identical to me, but since one of them has been drawn more 
recently than the other, they're not really equal.

Stephen Bloch
[email protected]


_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Reply via email to