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.stueberl.de!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!news.zanker.org!nntp.idg.pl!newsfeed.gazeta.pl!news.onet.pl!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: Wed, 6 Oct 2004 19:28:31 +0200 Organization: tp.internet - http://www.tpi.pl/ Message-ID: References: <41547dae$0$91007$39cecf19@news.twtelecom.net> <1g2d9xmnita9f.5ecju0eftkqw$.dlg@40tude.net> <87u4rkhddelw$.1uuoqhfyd2eay$.dlg@40tude.net> <6zobtdp3ckqx.plmvz5og15id.dlg@40tude.net> <2n0j0jfe6sex.2bcfi09ss44w$.dlg@40tude.net> <1xc5ofa4jkd2x.ejgxx5gcwy4l$.dlg@40tude.net> NNTP-Posting-Host: pt155.krakow.cvx.ppp.tpnet.pl X-Trace: atlantis.news.tpi.pl 1097083860 12124 217.99.216.155 (6 Oct 2004 17:31:00 GMT) X-Complaints-To: usenet@tpi.pl NNTP-Posting-Date: Wed, 6 Oct 2004 17:31:00 +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:4814 Date: 2004-10-06T19:28:31+02:00 List-Id: Hi, > This "same interface" is not a language object. It is a fiction, which > cannot be described in language terms independently on its implementation. > So you physically unable to program in terms of this interface. It simply > does not exist. It's not a fiction, it's a kind of agreement. The language doesn't see this interface directly, but you can use it. And if you try to violate it in a place where conformance to this interface is crucial, your program won't compile. > What can you do with vector<>? Operator[] defined on it is > not a function. It is a template function. Function template, you mean ;-) > You cannot call it outside of > another template. That template must in turn have the vector's element > type > as a parameter etc. So what? You just make a template instead of a function and the job is done. In all the places you call this template function, a compiler generates appropriate function from your template looking at the type of it's arguments, and that's it. >> so it's easy to write a code that copes with vectors of >> elements of different types. > > Really? Write code which reads from the stream a type X (from some > defined, > but large set of types) and then returns empty vector. Of course this can be done (Turing complete... ;-), but this is a very different kind of problem, isn't it? It's just like reading a type X and returning an object of type X. I don't think this would be much simpler if std::vector<> was implemented as runtime-polymorphic, not using generics. Of course there's the need to create a runtime-polymorphic wrapper class for std::vector<>, but the problem of choosing the appropriate type from a large set given this type's name as a string is the same in both cases. Besides can you do this better in Ada than in C++? (Or it wasn't your point to compare C++ with Ada in this respect, just to compare runtime vs. static polymorphism?) > Stepanov? (:-)) Could you give some references (links, book titles...)? I became curious (but it doesn't mean you've already convinced me ;-). With regards, Robert