¥The
Java static type system uses simple rules to infer types for Java expressions.
¥The
inferred type for an expression is conservative; it is guaranteed to be correct, but it may be weaker than what is required for a particular computation.
Example: recall
the finger exercise from Day 1 involving the DeptDirectory class hierarchy.
Given a variable d of type
Cons bound to a directory
containing two entries, the expression
d.getRest().getRest()
is ill-typed. Why?
¥