On 7/23/07, Steven Sacks <[EMAIL PROTECTED]> wrote:

If you look at it objectively, you're adding extra lines of code for no
reason.  AS2 has absolutely no gains from strict typing.

The compiled code doesn't gain anything - but if (like me) you're
writing code libraries to
be used by other programmers, the gain is type-checking at
compile-time. Which is
no small thing.

I grant you the hack I use throws away type safety (unless you
surround it with a run-time
check for instanceof Array), but if the hack is useful in that it lets
you present a type-checked API
to other coders, then it most definitely is worth it. Never
underestimate the ability of someone
to pass in the wrong parameters to a function. (Even yourself). And
then to spend hours scratching their (your) head to work out what's
wrong.

If you were using AS3, you could use :* but you're not so the equivalent
in AS2 is to leave off the type.

As I said earlier, in AS3 you can use the 'as' cast operator instead
of Array(a):

var b:Array=a as Array;

Ian
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to