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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c1fe4bc1dd51fc87 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!newsfeed.gamma.ru!Gamma.RU!colt.net!feeder.news-service.com!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Newsgroups: comp.lang.ada Subject: Re: User-defined type attributes (replacing genericity) From: Georg Bauhaus In-Reply-To: <30f629fd-69d3-4d40-995f-9933f52b8dad@s37g2000prg.googlegroups.com> <965suhjl0bxt$.74se2ylyksin.dlg@40tude.net> <1205505100.6445.60.camel@K72> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1205513926.7434.3.camel@K72> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 Date: Fri, 14 Mar 2008 17:58:46 +0100 Organization: Arcor NNTP-Posting-Date: 14 Mar 2008 17:58:46 CET NNTP-Posting-Host: b82b9030.newsspool4.arcor-online.net X-Trace: DXC=0XhI`4=gl^SFm0Y?OE@2^X4IUKejVXh>M0g\4HOGZZhdPkl2;OiP X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:20383 Date: 2008-03-14T17:58:46+01:00 List-Id: On Fri, 2008-03-14 at 15:48 +0100, Dmitry A. Kazakov wrote: > > I assume your answer to what follows will be that Ada semantics > > should be put under programmer control, > > What's wrong with having control over the semantics? (Control over the semantics of the language. I'm not a compiler, and I'm not imagining I am as good as someone who can routinely master the advanced parts of implementing Ada in user programs. That is what I think will be wrong. It is certainly possible to imagine some meta-flavoring for Ada. But I don't want to inspect such pieces of sophistication when they come out of the hands of ordinary programmers and have errors. There will be at least one more level of linguistic indirection between me and the LRM: the programmer's language interpretation as implemented in his semantics control.) > No, what you need is an interface implemented by both. You need to declare > Simple implementing Ordered. That will tell the compiler that the > predefined "<=" is an implementation of Ordered's "<=". Actually, it doesn't matter whether "<=" is predefined. It could just as well have been a user defined "<=". The Foo(...'Class) would have had one one general ("generic"?) implementation of Is_Highest, as described. This Is_Highest will have no specialization, but it will feature highly stylized indirection, dispatching to the implementing code for the respective "<=". > > Without generics, there is only one Is_Highest, as might be > > expected. > > Why there have to be two? The whole idea of generics was to have *one* > generic body. This is why it is called generic [programming]. I *can* have and I *did* have just one body in *source* code. We both know that Ada does not anywhere require that generics must not yield more than one lists of object code per generic. This would seem like a stupid restriction, one that I think no one has wanted to put in the minds of the language makers. > If you want to constrain the dispatching table > to the diagonal I don't want that language to inflict a dispatching table on me when that offers no advantage at all! - I don't need any dispatching here, - My code is more efficient without it, - Review of the generated code is simpler because there are fewer indirections. - There still is abstraction. If that doesn't count as advantages ... > Do not sell a limitation of generics to a > certain type of constraint as genuine advantage. >>From looking at generated code, the genuine advantage seems to be the total absence of dispatching code. Absence of code whose major contribution can, by the impression of the assembly listing, roughly be expressed as X.all.Call_Maker.all.Invoke instead of X.all.Call in the generic case