Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!microsoft!jimad From: jimad@microsoft.UUCP (JAMES ADCOCK) Newsgroups: comp.object Subject: Re: "Ad Hoc Polymorphism" -- I'm Quoting Someone Else Keywords: ad hoc polymorphism, reference to original use Message-ID: <10195@microsoft.UUCP> Date: 9 Jan 90 19:07:38 GMT References: <646@ajpo.sei.cmu.edu> Reply-To: jimad@microsoft.UUCP (JAMES ADCOCK) Organization: Microsoft Corp., Redmond WA Lines: 33 > "CLOS uses a technique called the generic function approach. > Common LISP -- and most LISPs -- support ad hoc polymorphism. > In ordinary polymorphism, the definition of an operation is > such that it is insensitive to the types of arguments passed > to it. In ad hoc polymorphism, the types of the arguments are > examined and appropriate code executed." There are at least three different ways to generate code for polymorphism. Like early Smalltalk systems, you can try to generate code that handles all possible cases of type equally, or like more recent Smalltalk systems you can try to determine all or some of the type information at compile time, and thus generate faster code -- possibly generating several versions of code to handle the most likely cases of types that may appear at run time. Or some compilers/languages attempt to determine most or all type info at compile time, invoking totally different routines depending on the runtime examination of the types involved. In that one language can be compiled using different strategies for code generation by different compilers, --and that interpreters for a language might take a totally different approach to code generation that compilers for the same language -- isn't it silly to try to define language features in terms of code generated? -- In any case, repeating the prejudicial naming conventions of previous authors seems to me to be a variation of a discredited defense: "I was only following [orders][precedence]." We need to be able to speak clearly, and without prejudice when comparing features of one language from the next. And we need to clearly differentiate the features of languages from the features of compilers and code generators -- except to the extent one can show a particular language feature *demands* such-and-such code be generated. [Recent articals comparing inheritence to delegation, are good examples] Prejudicial terminology only serves to confuse the issue, and to further isolate programmers in their favorite language camps.