This is a story about the Flash Player. All told, it's not a bad little browser plugin. It performs well, provides a sane display model, all's well. Unfortunately I've occasionally run up against issues to do with optimizations that are apparently performed by the Flash Player.
The most serious problems I've had have involved reflection. There are a few gotchas here. One is that the Flex compiler optimizes out unreferenced types so you need to be a bit careful to ensure all of your types actually get included in the SWF. If they don't get compiled in, you'll be surprised when
getDefinitionByName() throws an exception instead of giving you the type you expected. Oops.
However it's not always that simple. Today I was enhancing a little inversion of control framework of mine to handle constructor dependency injection. That's when I ran into a problem with
describeType() providing incomplete type information for constructor parameters unless an instance has already been created! That's not good because I need to know what the parameters
are before I create an instance!
Small world though. Seems someone else was doing dependency injection in Flex and encountered the problem. He came up with the same workaround as I did but I don't like it...
All for the sake of some lazy initialization the Flash Player is probably doing deep down. Lazy initialization should never disrupt the correctness of an application!