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: a07f3367d7,5add429c86f59001 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!h11g2000yqb.googlegroups.com!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: Ada vs Eiffel - Ada programmer approach Date: Thu, 4 Jun 2009 00:55:17 -0700 (PDT) Organization: http://groups.google.com Message-ID: <88f38fe3-01ec-407f-b7b6-84a1d10de7f1@h11g2000yqb.googlegroups.com> References: <405b5054-4c8f-4e16-9ea8-503a9b9f976e@t21g2000yqi.googlegroups.com> <4A19765C.608@obry.net> <8105b65f-4de9-4653-b43a-d55ee33f072d@k2g2000yql.googlegroups.com> 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 1244102117 23384 127.0.0.1 (4 Jun 2009 07:55:17 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 4 Jun 2009 07:55:17 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: h11g2000yqb.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:6208 Date: 2009-06-04T00:55:17-07:00 List-Id: On Jun 4, 9:30=A0am, Hibou57 (Yannick Duch=EAne) wrote: > On 26 mai, 15:37, Ludovic Brenta wrote: > > > [...] Ada's pragma Assert provides what I > > need in these (rare) cases =A0because I can put such pragmas in the > > middle of a subprogram, for example. > > > -- > > Ludovic Brenta. > > This is not the same as Eiffel assertions. Eiffel's assertions are > aware of the invokation contexte. Let say you have a class C and a > method M and the class C has an invariant I. Then, if a client invoks > M, the invariant will be checked before M returns. That's Ok, this is > the same as with "in code assertions". But if M is invoked by anoher > method of the class, i.e. as an implementation method (this is very > common to use a public method for internal purpose), you will have > this : the client of C invok a method M2 which in turn will invok M > (the client may or may not know about it). In this context, the class > invariant will obviously be checked before returning from M2, but *it > will not be check before return from M*. > > That is beceause M is allowed to left the class invariant in an > illegal state, as it may be the sole responsability of M2. > > So, Eiffel's assertions are not the same as "in code assertions". > Eiffel's assertions are well formalized. I think my point was precisely that Ada assertions were different from Eiffel's. I like the fact that, in Ada, I can place assertions in the middle of a complex subprogram; this is not possible Eiffel, as you aptly described. I agree that Eiffel's assertions are well-defined but my argument is that they are less useful and more diffucult to use in practice than the beauty of the design suggests. -- Ludovic Brenta.