In ActionScript 3 you can declare optional parameters like this:
function (i:int = 0, s:String = "", o:Object = null):void { }
So you can check if the user passed parameters s and o because you can test against the empty string or the null object if(s && o)...
But how do you allow an int to be truly optional? What if all values for i are valid, including 0, negative and positive integers? And what if you want to enforce integer (not use Number?)
what's the best practice here? the (...) rest may work but then you can't enforce a certain number of parameters at runtime, nor can you make for useful code completion?
I'm trying to implement a margin(top:int, right:int, bottom:int, left:int) method that allows right, bottom and left to be optional. Any thoughts?