Quote:
Originally Posted by DrJim
Thanks for the nice example. Demonstrating my basic ability to make good code inoperable - see the attached, which, when "D" is pressed and released, stops and gives an error message much the same as for as the walk and bumper car examples.
All I did was add an indexed loop to the dance method. Hence, when the "D" key is released, the method stops in mid-loop. Apparently this isn't a good idea as far as Alice is concerned (and I tend to agree - just wish the error message was clearer ).
|
This reminds me of when I used to go on business trips and land in a strange city late at night and be faced with driving and trying to read the street signs and read a map all at the same time. At least then I was able to get a map from the car rental agency. When something strange like this happens with Alice, there is no map to refer to, so it is guesswork all the way.
I have never been involved with a programming environment that had anything like a
doTogether block so I don't have any historical knowledge to fall back on in this area. I wonder what the Alice dev team intended for the behavior to be when a loop is included inside a
doTogether block. Then I wonder if the behavior that you get is what they intended for it to be. Probably not.
The attached file seems to confirm your belief that the problem arises when the while event terminates before the loop terminates. If you run this example and release the D-key during the wait period after the loop terminates and before the next execution of the method, no runtime error is generated.
Have you done enough testing to confirm that the use of a loop inside a
doTogether block always, or almost always results in an error. I tried to think of an easy way to write a test case that would eliminate the while event from the picture but so far haven't figured out how to do that. Everything I have come up with would cause the loop inside the
doTogether block to terminate in an orderly fashion.
Thanks,
Dick Baldwin