1. A method used by a compiler stored in a computer system, that when executed by a processor on the computer system, the method performs operations of determining a target type in an expression comprising an operator and at a plurality of expression operands, where said operands comprise n operands O 1 through O n , where n is greater than or equal to one, and where each operand O m is of a specific type T m , in a loosely-typed programming language, the method comprising the steps of: determining that the operator is not defined over at least one operand; determining as said target type a most encompassed type from among a first set of types of loosely-typed operands, where said first set of types comprises all resulting types of all first variant expressions, where each of said first variant expressions comprises said target expression with at least one of said expression operands, at least one expression operand being a user-defined type, replaced using widening type conversion, if said first set is not empty, said determining a most encompassed type comprising: calculating said first set comprising types resulting from the operation of said operator on any possible set of hypothetical operands HO 1 through HO n , where each hypothetical operand HO m is of a type to which there is a widening conversion from type T m ; and if said first set is not empty, determining as said target type a most encompassed type from among said first set; if said first set is empty, determining as said target type a most encompassing type from among a second set of types of loosely-typed operands, where said second set of types comprises all resulting types of all second variant expressions, where each of said second variant expressions comprises said target expression with at least one of said expression operands, replaced using at least one of widening and narrowing type conversion; and assigning said target type to said operator.