Subject: Re: making virtual functions in CL From: Erik Naggum <erik@naggum.no> Date: 1999/01/17 Newsgroups: comp.lang.lisp Message-ID: <3125580309189239@naggum.no> * tar@sevak.isi.edu (Thomas A. Russ) | This is a useful semantic concept when one is defining abstract | superclasses, ie, classes which are not expected to be instantiated | directly. This is typically done in order to have a common interface, or | in situations where some portion of the functionality can be implemented | by methods on the abstract class, but for which some additional concrete | methods are required for proper functioning. | | This does not seem like an unreasonable request. no, it isn't: it caused the concept of "interfaces" in Java. however, the "virtual" _implementation_ of this request as found in C++ is inherently flawed and should not be replicated anywhere. there are many ways to enforce a protocol or interface. a language may implement one way to do it, and that's all you get. Common Lisp is not similarly constrained. if you want to specify an interface that should cause all classes to implement their own methods, we should not look at how C++ was broken and put back toghether with duct tape -- the duct tape is not hold the solution. suppose a generic function would refuse to find methods for classes with certain properties or relationships (David has already implicated the generic functions, btw), such that there would be no danger of calling the method that "belongs" to a superclass, would it operationally define an interface? we have method classes, generic function classes, and method combination types at our command. can something be built with them that ignors the class precedence list and so does not find methods for superclasses of some or any of its arguments? this does violate the spirit of inheritance, but I believe the whole purpose here is to _have_ "disinherited" interface functions. let's do something C++ couldn't do: let's get it right. #:Erik -- SIGTHTBABW: a signal sent from Unix to its programmers at random intervals to make them remember that There Has To Be A Better Way.