To put us on the same page, please read the simple example below:

PHP Code:
function addone (x:Number){
    var 
returnval x;
    return 
returnval
}

var 
"1";

trace(addone(y)); 
This traces out 11, where the intended result was probably 2.

I know the problem would have been caught at compile time if the declaration of y included a non-number type, but sometimes you really need to deal with variant data types. Maybe an array element is being passed to the function, or the function is being dynamically called with function.apply where the arguments could be pretty much anything.

Is there a way to write the function that it will vocally fail if passed a bad type? Is there some sort of global setting in flash that could make the above code generate an error, or at least call something like "Number(x)" automatically?

I could write the addone function above to start with "Number(x);" but it pretty much defeats the purpose of putting the type in the function declaration.

It just seems like defining the argument types in the function is a lot of work in the long run with very little potential gain. I am not likely to accidentally call "addone("1");", or some other argument that is explicitly a non-number.