Type checking: We distinguish between strongly-typed and weakly-typed languages, depending respectively on the lower or higher tolerance for variables in a program not having an explicit data type associated with them. If the checking of this association is performed at compile time, we speak of statically-checked languages; if it occurs at run time, we speak of dynamically-checked languages.
Type equivalence: Criteria are defined to determine when two variables are considered to have the same type, even if they may have been declared differently. Some alternatives are:
Declaration Equivalence: Two variables have equivalent types when they refer to the same type declaration.
Structural Equivalence: Two variables have equivalent types if they slovenia email list were defined using the same basic types and the same type constructors.
Type conversion: To combine variables of various types, mechanisms such as the following are applied:
Implicit conversion (promotion), as when an integer variable is automatically converted to a real by appearing in a real expression.
Explicit conversion (casting): the conversion carried out by the programmer either by using predefined functions, or by using language facilities to “assign types”, such as the well-known casting.
Generalization of the type of a variable to a generic type, such as void in the C language.
Name Equivalence: Two variables have equivalent types if they were declared using the same type name in the same scope
-
- Posts: 325
- Joined: Thu Jan 16, 2025 8:32 am