catcall -- a solution

by Helmut Brandl (modified: 2010 Jul 15)

Eiffel in its current form is not completely type safe. Type errors (called catcalls in Eiffel speak) are possible. The compiler cannot detect these type errors. They usually trigger an exception at runtime.

These type errors are possible due to covariant redefinition of arguments and polymorphy. Both principles are very powerful in OO programming. Other languagues (like java, scala, etc.) solve this problem by disallowing covariant redefinitions of arguments and keeping polymorphy.

Since both, covariant redefinition of arguments and polymorphy, add a lot of power to object oriented programming, a solution to the catcall problem shall keep both, covariance and polymorphy, and rule out the potential type errors.

This paper introduces a solution to the catcall problem by imposing stricter rules and making inheritance more fine granular by keeping the expressiveness of the language.

The proposed solution might at first reading give the impression that it restricts the language too much. Because of that even the author of this paper didn't like the solution at the beginning. But this is due to the fact that the solution will change some coding pattern.

But digging more into the solution, the reader will realize that the solution is rigid in the sense that the compiler can detect all type errors and the software is as concise and expressive as before or better.

Read the detailed paper at -> White papers -> Language discussion -> Solution to the catcall problem.