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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,243dc2fb696a49cd X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail From: "Robert Kawulak" Newsgroups: comp.lang.ada Subject: Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl) Date: Mon, 11 Oct 2004 00:21:06 +0200 Organization: tp.internet - http://www.tpi.pl/ Message-ID: References: <41547dae$0$91007$39cecf19@news.twtelecom.net> <1g2d9xmnita9f.5ecju0eftkqw$.dlg@40tude.net> <1hl2mizeb27ku$.1f0asrbmb05mi.dlg@40tude.net> <7siml3c62lev$.usczt2y2l19c$.dlg@40tude.net> <15fk5715wm38q.3ie9r3bq8yuz$.dlg@40tude.net> <1ob4dexep087b$.ul8fb1ebgeok.dlg@40tude.net> <1dzt37oj3dnah.bwalpmfvyxd3$.dlg@40tude.net> NNTP-Posting-Host: pt109.krakow.cvx.ppp.tpnet.pl X-Trace: atlantis.news.tpi.pl 1097447140 897 217.99.216.109 (10 Oct 2004 22:25:40 GMT) X-Complaints-To: usenet@tpi.pl NNTP-Posting-Date: Sun, 10 Oct 2004 22:25:40 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original Xref: g2news1.google.com comp.lang.ada:5017 Date: 2004-10-11T00:21:06+02:00 List-Id: Hi, > In my view, array is a container and container is an abstract array. > Iterators should be introduced as index types In my view it's not. Not every container has semantics of an array (random access to every element and efficient insertions at the end of an array), although every array may have semantics of container. I think that for this reason containers shouldn't be all treated as abstract arrays, because this could be misleading. After all the reason for diversity of container types is their certain operations' efficiency difference. > Iterators should be introduced as index types, subdivided into ordered and > unordered ones. But aren't all iterators already ordered? Otherwise they couldn't iterate... > For ordered index types you can have ranges. Can't you have them with iterators? >>> 1. (for new types) language supports multiple interface inheritance. C++ >>> does, Ada 2005 will. >> >> 'elements of some class -=#not#=- derived from CElement' - I meant if >> you >> can derive, then there's no problem. > > Yes, but differently to C++ in Ada that would cover almost 90% of all > cases. This comparison seems to me a bit unfair. Don't you think that if C++ would use polymorphic containers, then its type system would also be adjusted to cover 90% of all cases? >> And you see, that's the point. I wrote: 'to make it work', and it's >> not as easy as it seems. In order to work with container algorithms and >> cooperate with other containers, your wrapper should also implement >> wrappers >> for wrapped type's iterators with wrappers for wrapped type's iterators' >> functions... Doesn't look to me like 'a matter of one or two code lines' >> ;-) Ah, sorry - I've mistaken making a wrapper for elements for making a wrapper for containers here... Never mind ;-) > In C++ it is checked upon inlining. In Ada it is checked upon > instantiation. With my proposal it will be checked when you create a > wrapper. The only difference is in the place and time. What do you mean by 'inlining' here? C++ templates are also instantiated, either explicitly or implicitly (in a place you use it). >> template Foo (A & X, B & Y) >> { >> ... >> Do_Something (X [I], Y [J]); >> ... >> } [...] > The contract of Foo is: > > 1. Foo takes two arrays as parameters. As long as we don't come to a common conclusion what an array is, this is meaningless... > 2.a Nothing is said whether indices or elements types are related. Isn't that true here? With regards, Robert Kawulak