I am learning ActionScript 3.0. Coming from Java world I can easily relate to strict compilation mode. I think having type safety checks at compilation time makes perfect sense.
This makes me wonder, why the compiler allows a standard mode were all the type safety checks are deferred to run time? Is compatibility with ol开发者_如何学JAVAder ActionScript specification the sole reason for having standard mode?
not all functions have to be run as strictly adhering to a type at compilation, especially if running dynamicly created variables and applications. have a look at the LiveDocs page for some good examples. It is mainly a stylistic thing as far as i have found, depends on the background you are from in your coding.
I'm not sure whether this'd qualify as an answer, because who really knows exactly other than the Flash team, but my guess is that because AS3's an implementation of ECMAScript, and thus loosely typed by definition, that that's probably the main reason why there's an option for standard/loose mode.
精彩评论