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 Path: g2news2.google.com!postnews.google.com!k2g2000yql.googlegroups.com!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: Ada vs Eiffel - Ada programmer approach Date: Tue, 26 May 2009 06:37:49 -0700 (PDT) Organization: http://groups.google.com Message-ID: <8105b65f-4de9-4653-b43a-d55ee33f072d@k2g2000yql.googlegroups.com> References: <405b5054-4c8f-4e16-9ea8-503a9b9f976e@t21g2000yqi.googlegroups.com> <4A19765C.608@obry.net> NNTP-Posting-Host: 153.98.68.197 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1243345069 9915 127.0.0.1 (26 May 2009 13:37:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 26 May 2009 13:37:49 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k2g2000yql.googlegroups.com; posting-host=153.98.68.197; posting-account=pcLQNgkAAAD9TrXkhkIgiY6-MDtJjIlC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:6018 Date: 2009-05-26T06:37:49-07:00 List-Id: Pascal Obry wrote on comp.lang.ada: > Tomek Walkuski a =E9crit : > > - what, in your opinion, is worse in Ada, in contrast to Eiffel? > > - memory management (not GC - I know that there is nothing in the > standard that forbid it - and this would be certainly really handful for > some domain) I agree that it would be nice if some Ada compilers would provide an optional garbage collector. One exists as a third-party add-on to GNAT but I've never used it and it's not part of AdaCore's or the FSF's distributions. In fact, I would like it if the garbage collector could optionally log all deallocations while the program runs, so I can find memory leaks, correct them, and remove the garbage collector later :) > - multiple inheritance I'm not sure this is a good thing. In fact, I'm not sure simple inheritance is always a good thing, either. I tend to prefer composition and generics. > - DbC with pre-condition/post-condition/invariant When I read Bertrand Meyer's "Object-Oriented Software Construction", I too thought that DbC was a brilliant idea. Now I'm less convinced. I see two major drawbacks to DbC: - pre/post conditions and invariants involve run-time checks most of the time (if not all the time). They slow the program down if enabled, or become useless when disabled for performance. I like static checking much better; Ada provides a lot of that out of the box (much more than Eiffel) and Spark goes way beyond even that. - in most of the examples I saw in the literature, only very simple subprograms would have a contract and the contract would mostly repeat the body of the subprogram. This redundancy is counter-productive. For more complex subprograms, it can be very difficult to write pre and postconditions and invariants; Ada's pragma Assert provides what I need in these (rare) cases because I can put such pragmas in the middle of a subprogram, for example. -- Ludovic Brenta.