Virtual functions are virtually invisible!

Gregory Ewing greg.ewing at canterbury.ac.nz
Mon Jul 4 04:43:35 EDT 2011


rantingrick wrote:
> what concerns me is the fact that virtual methods in derived
> classes just blend in to the crowd.

> I think we really need some
> sort of visual cue in the form of forced syntactical notation (just
> like the special method underscores).

If you're suggesting that it should be impossible to override
a method unless it is specially marked somehow in the base
class, I think that would be a bad idea.

One of the principles behind the design of Eiffel is that
classes should *always* be open to modification in any way
by a subclass. The reason is that the author of a class
library can't anticipate all the ways people might want to
use it. Consequently Eiffel has no equivalent of C++'s
"private" declaration -- everything is at most "protected".
It also has no equivalent of Java's "final".

I like the fact that Python doesn't have these either.

-- 
Greg



More information about the Python-list mailing list