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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no 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!postnews1.google.com!not-for-mail From: kevin.cline@gmail.com (Kevin Cline) Newsgroups: comp.lang.ada Subject: Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl) Date: 20 Oct 2004 19:51:03 -0700 Organization: http://groups.google.com Message-ID: References: <15fk5715wm38q.3ie9r3bq8yuz$.dlg@40tude.net> <1ob4dexep087b$.ul8fb1ebgeok.dlg@40tude.net> <1dzt37oj3dnah.bwalpmfvyxd3$.dlg@40tude.net> <1k2m0s9456ba7$.t0euzv9ux97l$.dlg@40tude.net> <1q7hilgv3yu3a$.1t931ae5tgr06.dlg@40tude.net> NNTP-Posting-Host: 24.219.97.214 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1098327064 23541 127.0.0.1 (21 Oct 2004 02:51:04 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 21 Oct 2004 02:51:04 +0000 (UTC) Xref: g2news1.google.com comp.lang.ada:5560 Date: 2004-10-20T19:51:03-07:00 List-Id: "Robert Kawulak" wrote in message news:... > Hi, > > > #define is also parsed! In compiled languages "parsed" is far less than > > "compiled" and the results of these two actions are much different too. > > OK, by saying 'parsed' I meant 'compiled'... Don't catch me in my > words! ;-) > > > The > > margin is not absolute of course, but parsed template body is closer to > > parsed #define body than to a compiled true body. > > Templates are not so close to #defines. Using the 'export', keyword their > implementation may be *compiled* in only one translation unit, and you may > use them anywhere given only their declarations - just like ordinary > functions and objects (well, at least in theory, because there are not so > many compilers supporting 'export' yet... But I hope this will change soon). > > > What if the *implementation* > > does not fulfill the contract, while the parameter does? > > Ah, I see (at last ;-) what's your point. But is it really necessary to > check if the *implementation* is contract-conformant? If it's not > contract-conformant, then you get a compile-time error anytime you try to > use it, the only difference I see is that such an error is detected only > during instantiation. I know it'd be nice if the implementation would be > checked for contract-conformance during compilation (parsing, whatever ;-), > but OTOH I don't see not doing this such an issue... Actually, this wouldn't be so nice. As it is, member functions are instantiated individually, so we can write: template class Container { typedef ... const_iterator; void write(ostream& out) const { for (const_iterator i ... ) { out << *i; } } } and still be able to instantiate Container even if operator<<(ostream&, X) is not defined. There is no error unless we call Container::write. Of course, modern C++ experts would assert that functions like write should be free functions and not class member functions.