Question 1-10
Many languages (such as Java, Ada, and ML) do
static type checking, while others (such as PostScript, Scheme,
and Smalltalk) use dynamic type checking.
- a. Name and explain an advantage of compile-time type
checking over run-time type checking.
- b. Name and explain an advantage of run-time type
checking over compile-time type checking.
Solution
- a.
Programmer errors are detected at compile-time, so that debugging
happens more reliably and faster.
Program execution is faster, as type-checking for each operation
is expensive.
- b.
It allows more flexibility to the programmer, so that variables can
mean different things at different times.
The code tends to be simpler, as it does not require type
annotations.
Back to Review for Quiz 1