Okay thanks for replying Darren,

So just to clarify then, is type Object commonly used with multi- 
typed vars?

Thanks,
Moses

On May 29, 2006, at 2:33 PM, Darren Cook wrote:

>> 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?
>
> "mtasc -strict" won't let you leave it untyped.
>
>> 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.
>
> That's useful to know. But IMHO the advantages of strict are still  
> worth
> it, and "optimize later".
>
> Darren

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

Reply via email to