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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder.news-service.com!feeder.news-service.com!newsfeed-fusi2.netcologne.de!195.14.215.230.MISMATCH!news.netcologne.de!newsfeed-hp2.netcologne.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Ada vs Eiffel - Ada programmer approach Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH 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> Date: Tue, 9 Jun 2009 09:39:51 +0200 Message-ID: <1jyf6p60hv1n4$.1pavbtr5qwfnz$.dlg@40tude.net> NNTP-Posting-Date: 09 Jun 2009 09:39:51 CEST NNTP-Posting-Host: 194426cf.newsspool2.arcor-online.net X-Trace: DXC=c;h4J@GijjcfF8a^:6>b7eA9EHlD;3Ycb4Fo<]lROoRa^YC2XCjHcbi:D]QH12R7@eDNcfSJ;bb[eFCTGGVUmh?dLK[5LiR>kgboP>HcSFVJ2i X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:6386 Date: 2009-06-09T09:39:51+02:00 List-Id: On Mon, 8 Jun 2009 17:52:27 -0500, Randy Brukardt wrote: > "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). I do not see any difference. Invariant is merely a private constraint. User-defined constraint is a [public] part of the invariant. > For instance, a user-defined > constraint can apply to a formal parameter but not to the actual parameter > object (just as any other constraint). Hmm, I think this confuses constraints put on a type/subtype with discriminants of an object. Obviously, any combination of discriminants' values determine some anonymous subtype with a corresponding invariant. That is an invariant of the object only in the sense that the object has this anonymous subtype. Objects do not have invariants. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de