What is a compatible type?
A type that is either legal for the operator or can be implicitly converted (coerced) to a legal type.
Define type error.
The application of an operator to an operand of an inappropriate type.
Define strongly typed.
A language is strongly typed if type errors are always detected.
Why is Java not strongly typed?
Although strictly typed, the text notes that its extensive coercion (e.g., float + int) weakens the value of error detection associated with strong typing.
What is a nonconverting cast?
It is a conversion (like Ada’s Unchecked_Conversion) that extracts the value of a variable of one type and uses it as if it were another type without actual conversion.
What languages have no type coercions?
ML and F#.
Why are C and C++ not strongly typed?
Because they include union types which are not type checked.
What is name type equivalence?
Variables have equivalent types if they are defined in the same declaration or use the same type name.
What is structure type equivalence?
Variables have equivalent types if their types have identical structures.
What is the primary advantage of name type equivalence?
It is easy to implement.
What is the primary disadvantage to structure type equivalence?
It is difficult to implement (requires comparing entire structures) and breaks the ability to differentiate between types that happen to have the same structure but different meanings (e.g., Celsius vs. Fahrenheit).
For what types does C use structure type equivalence?
For nonscalar types other than struct, enum, and union (such as arrays).
What set operation models C’s struct data type?
The Cartesian (or cross) product.