Someone is telling me that a function input that is intended to  
accept more than one datatype (i.e. String & Number) should be typed  
as :Object to keep it generic.  Like,

public function setColor(colorStringOrNumber:Object):Void

Is :Object the accepted standard, or is it better to just leave it  
untyped in AS2? (It looks like as3 allows * to be used as an input  
datatype which will be nice.)

I noticed that using :Object seems to require a little more code  
within the function - some casting, and occasionally the creation of  
separate (typed) locals to handle each input type. Seems to be riding  
the line between correct and confusing anyway, since folks looking at  
the declaration might be more confused by :Object when the correct  
inputs are String or Number - so I'm almost more in favor of untyped.

If this is just a code-purist thing I'd rather leave it dirty because  
I actually think it is more clear to leave it untyped, but if there  
really is some standard to use :Object I would like to uphold it.

Best way to go? Thanks,

Moses

_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

Reply via email to