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.
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. 14. The method of claim 9 , wherein the translating further comprises: identifying a virtual function call in the code segment; translating the virtual function call to an intermediate representation that when converted to computer-executable instructions and executed on a computer cause the computer to perform a method including, fetching a pointer associated with a virtual table, wherein the translating assigns a temporary variable to store the result of the fetching; and wherein the determining further comprises not retaining type information for the temporary variable assigned to store the result of the fetching, because the type of the temporary variable is designated as the unknown type.