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,243dc2fb696a49cd X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl) Date: Thu, 21 Oct 2004 10:39:24 +0200 Message-ID: <1ln11ox1uk4ga$.1me7oe7jcrv9y$.dlg@40tude.net> 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> <1k2m0s9456ba7$.t0euzv9ux97l$.dlg@40tude.net> <1q7hilgv3yu3a$.1t931ae5tgr06.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de yTLlVtabKmPr37XV0gHQrwsrB47/3Exc5cFWXZpD/nlLSRaKU= User-Agent: 40tude_Dialog/2.0.12.1 Xref: g2news1.google.com comp.lang.ada:5565 Date: 2004-10-21T10:39:24+02:00 List-Id: On Wed, 20 Oct 2004 22:06:28 +0200, Robert Kawulak wrote: >> 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. But software design, at least with Ada, is not about detecting errors. That would be debugging. (:-)) The advantage of contracts is in knowledge. With templates when you instantiate and get an error, you cannot judge who was wrong, contract is the code of laws to judge. [Provided that you have a gift of deciphering template error messages, which tend to be longer than the source code!] > 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... Kevin Cline in other post gave an excellent example of how awful it is. His example shows that a template developer have to write extensive tests to detect errors which, otherwise, would be routinely detected by any compiler. In his view it is an advantage that no error will be detected until write is used. In my view it is a fallacy. If write is declared in Container, then it is a contract, is it? Then if an instantiation with some T makes its use impossible, then the contract is violated. On the other hand, if that instantiation is right and there is no need in write for a Container, then it is Container which violates the implied contract by placing there write. This or that way, the result is same. A contract model works only if it does not leak. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de