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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,103b407e8b68350b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-27 02:11:46 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!syros.belnet.be!news.belnet.be!feed.news.nacamar.de!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: Anybody in US using ADA ? One silly idea.. Date: Mon, 27 Jan 2003 11:11:43 +0100 Message-ID: References: <_VkW9.266404$FT6.43771824@news4.srv.hcvlny.cv.net> <1043339266.922562@master.nyc.kbcfp.com> <7iLY9.2401$qb1.464@nwrddc01.gnilink.net> NNTP-Posting-Host: tar-alcarin.cbb-automation.de (212.79.194.111) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: fu-berlin.de 1043662303 32390854 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:33446 Date: 2003-01-27T11:11:43+01:00 List-Id: On Sun, 26 Jan 2003 06:32:35 GMT, Hyman Rosen wrote: >Dmitry A. Kazakov wrote: >> To verify the code using templates, you have to look into the > > bodies of the template functions. > >You just have to read the documentation, just like any other >function with preconditions. If nothing other helps, please, read the documentation! (:-)) Precondition is a part of the specification, not body. Let you change the body in a way that it will use an operation with was not used before. Then one should revise all the code that uses this body. With proper DbC you should check only the contracts and most of these checks does the compiler. In other words, "Hashable" has to be a type property, while with generics it is rather a property of the given compilation. >> If you do not plan to put a type into a hash table, why should it be >> "Hashable"? > >Because in the absence of multiple inheritance, there is a tendency >to "pile on" stuff that might be useful, because it's hard to add later? Yes and that is absolutely wrong. Thick base classes is an evil caused by absense of MI, lack of supertyping and overuse of representation inheritable. >> Unfortunately in most cases Circle will never be converted to Ellipse and >> back, even though the compiler has everything for that. > >Why? It looks like you wrote the code correctly to do just that. If I define a method or a free a procedure on Ellipse: void Foo (Ellipse& A); then the compiler will not substitute a Circle for Ellipse. Because it has first to convert Circle to Ellipse, then apply the procedure and then to convert the result back. It is similar to what Ada does with by-value parameters or when an in out parameter is explicitly converted like in: Get_Real (Float (Some_Integer)); --- Regards, Dmitry Kazakov www.dmitry-kazakov.de