Question 2-1

Explain why generics make more sense as a feature in statically typed languages than in dynamically typed languages.

Solution

The primary benefit of generics is to allow a programmer to write code that can accomodate a range of types. This is already possible in dynamically typed languages, since code can be ambiguous about type, and this is resolved at run-time.

Back to Quiz 2