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-Thread: a07f3367d7,dbbbb21ed7f581b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!newsfeed.straub-nv.de!uucp.gnuu.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Operation can be dispatching in only one type 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: <025105f2-5571-400e-a66f-ef1c3dc9ef32@g27g2000yqn.googlegroups.com> <1nbcfi99y0fkg.1h5ox2lj73okx$.dlg@40tude.net> <59acf311-3a4a-4eda-95a3-22272842305e@m16g2000yqc.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> Date: Sat, 5 Dec 2009 11:32:11 +0100 Message-ID: <1gcigitaii0u0.1psu2vj52e66g$.dlg@40tude.net> NNTP-Posting-Date: 05 Dec 2009 11:32:15 CET NNTP-Posting-Host: 771f73a2.newsspool3.arcor-online.net X-Trace: DXC=bLjn5oeC>5hFXUDVUnEXQmMcF=Q^Z^V3h4Fo<]lROoRa8kF On Fri, 4 Dec 2009 20:45:19 -0600, Randy Brukardt wrote: > Writing in Ada 2012 as proposed today > (and that might change before it gets standardized): > > procedure Do_Something (Window : Claw.Basic_Window_Type; ...) > with Pre => Is_Valid (Window); Why not to allow such constraints for subtypes? E.g. subtype Valid_Window_Type is Window_Type when Is_Valid; then simply: procedure Do_Something (Window : Valid_Window_Type; ...) > is surely better because it puts the check in the spec where the caller can > see it, rather than in comments that can be ignored. (And it also opens up > the possibility of tools/compilers warning when it is *not* true at the > point of a call, both potentially eliminating generated code and making > error detection earlier.) Yes, but I do prefer the subtypes as the vehicle, rather than arbitrary preconditions put here and there on the subprograms. The latter is kind of weak typing to me. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de