Vector.unshift Gotcha (for the time-being)
I didn’t see this coming:
var list:Vector.<MockObject> = new Vector.<MockObject>();
var a:MockObject = new MockObject("a");
var b:MockObject = new MockObject("b");
var c:MockObject = new MockObject("c");
list.push(a);
trace(list); // outputs "a"
list.push(b);
trace(list); // outputs "a,b"
list.unshift(c);
trace(list); // outputs "c,a"
No, I haven’t made a mistake. It’s a bug! The Flash 10 Language Reference explicitly says that this isn’t supposed to happen. After a little searching, Adobe JIRA affirms that this bug is known, and fixed – well fixed in the ‘Future – Next Build’ release.
I really hate wasting two hours of my time to discover that my test case is failing because the Flash Player is itself broken, and not because I’m an idiot. Clearly, Adobe don’t unit test. As ever, I am really glad that I do!
-
http://twitter.com/alecmce alecmce
-
Bart


