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,dbbbb21ed7f581b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!news.mixmin.net!news2.arglkargh.de!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Operation can be dispatching in only one type Date: Wed, 9 Dec 2009 22:09:48 -0600 Organization: Jacob Sparre Andersen Message-ID: References: <025105f2-5571-400e-a66f-ef1c3dc9ef32@g27g2000yqn.googlegroups.com> <4b150869$0$6732$9b4e6d93@newsspool2.arcor-online.net> <18vlg095bomhd.8bp1o9yysctg$.dlg@40tude.net> <4b152ffe$0$7615$9b4e6d93@newsspool1.arcor-online.net> <19nhib6rmun1x$.13vgcbhlh0og9$.dlg@40tude.net> <4b1557d0$0$7623$9b4e6d93@newsspool1.arcor-online.net> <4b15bf2b$0$7623$9b4e6d93@newsspool1.arcor-online.net> <1jcbtmi5rztyp$.norvlhez9i9$.dlg@40tude.net> <4b179ffb$0$6591$9b4e6d93@newsspool3.arcor-online.net> <1gcigitaii0u0.1psu2vj52e66g$.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1260418191 23123 69.95.181.76 (10 Dec 2009 04:09:51 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 10 Dec 2009 04:09:51 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5843 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Xref: g2news1.google.com comp.lang.ada:8361 Date: 2009-12-09T22:09:48-06:00 List-Id: "Dmitry A. Kazakov" wrote in message news:c7bquicl77wg$.1lpuev0db0z46$.dlg@40tude.net... > On Tue, 8 Dec 2009 05:30:30 +0100, stefan-lucks@see-the.signature wrote: ... >> Isn't that essentially the same as the invariants in Eiffel? > > I see differences. Both Window_Type and Valid_Window_Type are visible. > Eiffel invariant deals with one type. Further the invariant is an > implementation detail normally invisible for the clients. Subtype is a > publicly declared constraint (contract). Right. We're actually considering both. We're almost certainly going to have invariants, on private types only, which are required to be checked only at the boundary of the defining package. (Such invariants can be abused, but they still more predicable than those on visible types.) Such invariants apply to all values of a type. Subtype predicates (for the lack of a better name, they're definitely *not* constraints, read AI05-0153-1 to see why) apply only to a view of a type, and would mainly be checked when a conversion to the subtype is done. (Almost everything interesting in Ada is technically a conversion to a subtype, so that covers the vast majority of interesting cases.) The current thinking is that using a subtype with a predicate in an array index, slice, entry family, and possibly some cases I forgot about would be illegal (or raise Program_Error in a generic body). We don't want to prevent the construction of subtypes like: subtype Odd_Integer is Integer with Predicate => Odd_Integer mod 2 = 1; but we sure don't want them in arrays. I'm not throughly convinced that this is the right approach, but more work needs to be done on the proposal in any case. Randy.