I find a new compiling bug in Flash 8:
function largerThanTen(n:Number):Boolean { return n>0; } trace(largerThanTen(10));
Obviously, we won't, on purpose, change the > symbol(2nd line) into a plus operator. But, what if we want create a function that is used to do sth else but comparing numbers. I accidentally changed the alter the "Boolean" to "String" and run it. Yes of course the compiler will tell us about a type mismatch out there. However, after I use plus operator, no warning for this kind:
function largerThanTen(n:Number):String { return n+0; } trace(largerThanTen(10));
And what's more interesting is that I've also tried other operators, such as -, *, /, ^, etc., all of which will bring about an error reporting. Could someone give us a reasonable explanation to this phenomenon? I would rather classfy it as a compiling bug in Flash 8.
|