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=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!ames!think!barmar From: barmar@think.COM (Barry Margolin) Newsgroups: comp.lang.ada,comp.lang.c Subject: Re: "C" vrs ADA Message-ID: <8022@think.UUCP> Date: Tue, 1-Sep-87 18:03:42 EDT Article-I.D.: think.8022 Posted: Tue Sep 1 18:03:42 1987 Date-Received: Sat, 5-Sep-87 04:47:54 EDT References: <1065@vu-vlsi.UUCP> <2231@cbmvax.UUCP> <36@sarin.UUCP> <1678@rti.UUCP> <1963@sfsup.UUCP> Sender: news@think.UUCP Reply-To: barmar@godot.think.com.UUCP (Barry Margolin) Distribution: na Organization: Thinking Machines Corporation, Cambridge, MA Xref: mnetor comp.lang.ada:628 comp.lang.c:4103 List-Id: In article <1963@sfsup.UUCP> mpl@sfsup.UUCP (M.P.Lindner) writes: >In article <1678@rti.UUCP>, jb@rti.UUCP writes: >] generic >] type ITEM is private; >] with function GREATER(A,B : ITEM) return BOOLEAN is <>; >] package SORTING is >] >] type VECTOR is array(NATURAL range <>) of ITEM; >] >] procedure MERGE_SORT( A, B : VECTOR; RESULTS : out VECTOR ); >] >] end SORTING; >But if I have to make a GREATER function I could have done it in C (see man >page for qsort(3)! Therefore I maintain my claim that Ada is *not* a proper >implementation of an object oriented language (like Smalltalk). Wait a second. How can you write a generic sort in any language without requiring that there be an ordering predicate for the element type? This is not like qsort(3). Qsort requires that the ordering predicate be specified in the call. The above Ada code merely specifies that the generic may only be instantiated for types for which GREATER (A,B: type) is defined. Smalltalk and Flavors have the same requirement, but they don't notice the missing method until runtime. --- Barry Margolin Thinking Machines Corp. barmar@think.com seismo!think!barmar