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,91276ec2ea911d3f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!news3.google.com!news.glorb.com!solnet.ch!solnet.ch!news-zh.switch.ch!switch.ch!cernne03.cern.ch!cern.ch!news From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Generic procedures and their parameters Date: Fri, 08 Sep 2006 11:11:35 +0200 Organization: CERN - European Laboratory for Particle Physics Message-ID: References: <15ibl2xejtc68.1eg90p1fwn18p$.dlg@40tude.net> NNTP-Posting-Host: abpc10883.cern.ch Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sunnews.cern.ch 1157706696 24042 (None) 137.138.37.241 X-Complaints-To: news@sunnews.cern.ch User-Agent: Thunderbird 1.5.0.5 (X11/20060801) In-Reply-To: <15ibl2xejtc68.1eg90p1fwn18p$.dlg@40tude.net> Xref: g2news2.google.com comp.lang.ada:6517 Date: 2006-09-08T11:11:35+02:00 List-Id: Dmitry A. Kazakov wrote: >> In C++ the fact >> that int is ordered does not require that it relates to some Ordered >> class. > > Which is unfortunate for both C++ and Ada, because "to be ordered" = "a > member of Ordered class." There is no obvious reason why they should be > different. No obvious, but subtle, yes. Integer is Ordered, but so is String. Can you imagine a Sequence_Of_Ordered containing, say, 7, 123, "Dmitry", -5, "Maciej"? All these objects are Ordered. Just like Banana is Fruit and Apple is Fruit, right? Still, I can imagine a container of Fruits with Bananas mixed with Apples, but certainly not a container of Ordered - and the problem is that the values listed above don't really share much in common. Can you sort a Sequence_Of_Ordered? No. So - what does it really mean that Integer and String are both Ordered? OK, I know - we forgot that their "domains" of ordering are disjoint. But then - what's the point of having Ordered'Class? As far as I perceive it, the fact that Banana is Fruit and the fact that Integer is Ordered are two facts of *different kind*. The former is related to the "business disctionary" (nice buzz), whereas the latter is more an information about the type. For me, these two facts exist on separate levels and should not be mixed in the same inheritance hierarchy. Moreover, the language should give me distinct tools to express these distinct kinds of facts and for example in C++ I use class inheritance for Banana is Fruit, but type traits for Integer is Ordered. If I had to express these two in the same way (and in the same hierarchy) I would feel a bit uncomfortable. Kind of "weak type safety on the meta-level". There is another "small issue". Robert mentioned that trees are aesthetically pleasing. The problem is that with Ordered (Comparable, Summable, etc.) there is no tree any more because of massive proliferation of multiple inheritance that is then used to express facts about types. The only "pleasing" thing left in the resulting mess is that there are still no cycles. ;-) -- Maciej Sobczak : http://www.msobczak.com/ Programming : http://www.msobczak.com/prog/