PDA

View Full Version : ArrayStoreException in Array of Positions


JungleJim
07-04-2007, 04:13 PM
A "mean queen" exception pops up whenever I try to store a Position object into an array of positions.

More Detail>>> says that it is an ArrayStoreException which should occur when Array covariance is broken during run time. So I print out the value being stored and a default value out of the array (after disabling the set item to command) and both print out as having class ecu.cmu....math.Vector3. Here is the code being played:

set item 0 to right=1,up=2,forward=3 in Chicken.mark more...
print item 0 from Chicken.mark
print right=1,up=2,forward=3

If Chicken.mark were not an array of positions, then command 2 above should not print out a Vector3. If the result of the ,, operation were not a Vector3 then the 3rd command would not print out a Vector3. The first command is what triggers the exception (because disabling it removes the exception)

Is there some kind of hidden coercion in the first command changing the class of the value to be stored???

If so, is there a workaround?

Thanks

DickBaldwin
07-05-2007, 12:56 PM
I don't have an answer to your question. However, a couple of weeks ago, I encountered an apparent bug of the most fundamental nature involving Alice arrays. (See http://www.alice.org/community/showthread.php?t=810) Since then, I have been very skeptical of using Alice arrays.

Maybe you could use a list to accomplish the same thing as a workaround.

Dick Baldwin