9. A method of selectively retaining type information during compilation in a code segment written in a programming language, the method comprising: translating the code segment from the programming language to one or more intermediate language representations; for each intermediate language representation, determining whether to retain type information for one or more elements of the intermediate language representation, wherein the one or more intermediate language representations include one or more elements having a known type; based on the determination, associating at least one of the one or more elements of the intermediate language representation with a type, designated as an unknown type, indicating the element can be of any type; and type-checking the one or more intermediate language representations based on a rule set, wherein the rule set comprises rules for type-checking the type designated as the unknown type.
13. The method of claim 9 wherein at least one of the one or more representations of the intermediate language supports dropping type information by designating a type as an unknown type.