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-7-bit From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Ada vs Eiffel - Ada programmer approach Date: Mon, 8 Jun 2009 17:52:27 -0500 Organization: Jacob Sparre Andersen Message-ID: References: <405b5054-4c8f-4e16-9ea8-503a9b9f976e@t21g2000yqi.googlegroups.com> <4A19765C.608@obry.net> <8105b65f-4de9-4653-b43a-d55ee33f072d@k2g2000yql.googlegroups.com> <88f38fe3-01ec-407f-b7b6-84a1d10de7f1@h11g2000yqb.googlegroups.com> <878wk299uj.fsf@willow.rfc1149.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1244501577 14439 69.95.181.76 (8 Jun 2009 22:52:57 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Mon, 8 Jun 2009 22:52:57 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Path: g2news2.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!feed.ac-versailles.fr!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail Xref: g2news2.google.com comp.lang.ada:6377 Date: 2009-06-08T17:52:27-05:00 List-Id: "Robert A Duff" writes: ... > An invariant (whether it be a pragma, or some special syntax) would be > attached to a type, and would mean "all objects of this type have > this property, always" (except that maybe objects can temporarily > violate their invariant, so long as the code puts it back). > > A related concept that has been discussed is "user-defined constraints". > I'm not sure what the difference is, exactly -- I think with user-defined > constraints, you can't "temporarily violate". A user-defined constraint applies to a view (usually via a subtype), while an invariant applies to a type (always). For instance, a user-defined constraint can apply to a formal parameter but not to the actual parameter object (just as any other constraint). Calling such a thing an "invariant" would be completely wrong, because it's not invariant at all - the values are only checked against the constraints at the points where Ada does subtype conversions (and possibly a few others - this is TBD and hopefully will be discussed at this week's ARG meeting). Tucker explains the distinction somewhat in his new draft of AI-146 (to be posted tonight, along with the ARG meeting agenda). There also is a partial user-defined constraint AI (AI-153), but I got stuck over how invariant we want these to be. Check them both out tomorrow. Randy.