Abstract
Types in programming languages cannot model many properties of real world objects and quantities. Consequently, many errors resulting from the inconsistent usage of program objects representing real world objects and quantities cannot be detected automatically. For example, the real variables PRICE and WEIGHT, representing the price of diesel fuel and the weight of a person, may be inadvertently added, giving a non‐sensical value; such an error cannot be detected by a compiler. The programming language Ada introduces the concept ofderivedtypes to tackle this problem. An alternative solution to this problem is the incorporation ofunits of measureas a new data attribute. Derived types only partially solve the problem of detecting the inconsistent usage of objects; some valid usages of objects are also not allowed. Moreover, the solution is inelegant and inconvenient to use. On the other hand, specification of units of measure solves the problem elegantly and conveniently. The two solutions are compared and analysed. Several ways to implement units of measure in Ada are examined.

This publication has 6 references indexed in Scilit: