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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!uucp.gnuu.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Fri, 02 Aug 2013 00:20:47 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Generics vs. O-O? References: <6238c325-79c5-4537-ba55-2800110dc6df@googlegroups.com> <1wugpqyea6s39$.e2e8eshup5wn$.dlg@40tude.net> In-Reply-To: <1wugpqyea6s39$.e2e8eshup5wn$.dlg@40tude.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <51fadf40$0$6557$9b4e6d93@newsspool4.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 02 Aug 2013 00:20:48 CEST NNTP-Posting-Host: 72c895cf.newsspool4.arcor-online.net X-Trace: DXC=N4W_lcIgMI=]E=H1Q9`7874IUKPCY\c7>ejV8g5K?22N8T<9VjhSKI3]J9: X-Complaints-To: usenet-abuse@arcor.de X-Original-Bytes: 2698 Date: 2013-08-02T00:20:48+02:00 List-Id: On 01.08.13 21:24, Dmitry A. Kazakov wrote: > 7. Formal generic types of Ada are weakly typed. Matching is by structure. > User-defined generic types (ADTs) are not supported. User-defined > operations on formal types are not supported. The language of formal > generic parameters is somewhere between FORTRAN-IV and K&R C. Not quite far from a misrepresentation of Ada generics. Nothing in the languages mentioned can require type equivalence by name in whatever generic formals, as in package N is type T is range -1 .. 1; generic type S is new T; package Pointless is end; type Q is range -1 .. 1; package Exmpl is new Pointless (Q); -- error end N; Equivalent structure of scalar types T and Q won't do. > 9. Generic units are basically non-testable. Substitutability issues are > difficult to verify because of 7. With generics, substitutability issues arise as soon as one wishes to subsume the mechanism of generic units under a formally extraneous type systems. So, judicious use of this language features for things other than typing might be the better choice. In general, attributing "weakly typed" to languages will profit from being done in a more detailed, more informative, and therefore more convincing way. The C example struct A {}; struct B {}; int f(struct A x) {} int g(struct B y) {} void test() { f((struct B){}); /* compile time type error */ } shows that C is not entirely weakly typed!