From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8603e726bcf960f5 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Ada OO Date: 1996/11/25 Message-ID: #1/1 X-Deja-AN: 198610793 references: <57aq7s$30j@yuggoth.ucsb.edu> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-11-25T00:00:00+00:00 List-Id: In article <57aq7s$30j@yuggoth.ucsb.edu>, Graham Hughes wrote: >- From what I've seen, Ada OO is very similar to CLOS; The syntax is similar, but other than that, they are not similar. CLOS is vastly more powerful, and more complicated, than Ada (or any other OO language I've ever used). In particular, CLOS has multi-methods, whereas Ada does not. >Given this, how are C++-style virtual methods defined? The stuff I've >looked at implied that all subprograms defined in the package spec are >virtual, and pure virtual methods are achieved by (appending? >prepending?) abstract to the definition. That's right -- if one or more parameters are of type T, and T is tagged, and the procedure is in the same package as T, then it's virtual (which Ada calls "dispatching"). And right, pure virtual is pretty much the same thing as abstract. Dispatching-on-function-result is something C++ doesn't have. Also, Ada has class-wide parameters -- a procedure with class-wide parameters is not dispatching (unless some other parameter makes it so). >With CLOS, all defmethod (or is it defgeneric? been a while) methods are ^^^^^^^^^^^^ Yeah, me too. I haven't used it since it was called "Flavors". >effectively virtual, and pure virtual methods are just a defgeneric (?) >with no body definitions. Is this the way Ada OO works? Well, sort of. But in CLOS the methods are scattered all over, whereever the programmer chooses. In Ada, they're collected together in a single package. >Finally, re: the abstract; is it needed in the package body, or can it >be ommitted? Umm. Not sure what you mean. Can you give an example? Usually, "abstract" is placed on the type, and on some or all of its "methods", and the type is *usually* in a package spec, not a package body. And if the method is abstract, it has no body in the package body. - Bob