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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:aed:376a:: with SMTP id i97mr14221900qtb.44.1575657249685; Fri, 06 Dec 2019 10:34:09 -0800 (PST) X-Received: by 2002:aca:5cc1:: with SMTP id q184mr11284462oib.122.1575657249546; Fri, 06 Dec 2019 10:34:09 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!g89no508027qtd.0!news-out.google.com!w29ni302qtc.0!nntp.google.com!g89no508019qtd.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 6 Dec 2019 10:34:09 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=146.5.2.231; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 146.5.2.231 References: <87muca3vgd.fsf@nightsong.com> <57d49047-0a61-4d13-8822-d004732a3acc@googlegroups.com> <3b1b248b-43d0-4762-b1f5-1c5460d24c8b@googlegroups.com> <5e222e6c-7afe-4349-ac66-d9b78ca40ec6@googlegroups.com> <27b11294-d628-4118-8328-a4a9a3946937@googlegroups.com> <80bcdfd1-b1e5-4ebf-aa8a-4beaba5ec3c2@googlegroups.com> <60e61003-409d-4bd5-9784-8ddad5942934@googlegroups.com> <4f659af6-c840-4509-9f76-e9a96b547a55@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Beginning Ada Programming, by Andrew T. Shvets (2020) From: Shark8 Injection-Date: Fri, 06 Dec 2019 18:34:09 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:57669 Date: 2019-12-06T10:34:09-08:00 List-Id: On Thursday, December 5, 2019 at 9:36:00 AM UTC-7, Dirk Heinrichs wrote: > Am 03.12.19 um 18:02 schrieb Shark8: > > > Perhaps the easiest way to do this is by doing something that's (e.g.) much more complex in C, but relatively straightforward in Ada -- perhaps modeling a Password in the software: > > > > Type Digit is Character Range '0'..'9'; > > Type Upper_Case is Character Range 'A'..'Z'; > > Type Lower_Case is Character Range 'a'..'z'; > > Type Symbol is Character > > with Static_Predicate => Symbol in '!'|'@'|'#'|'$'|'%'|'^'|'&'|'*'; > > > > Minimum_Length : Constant := 8; > > Maximum_Length : Constant := 32; > > > > Type Password is new String > > with Dynamic_Predicate => Password'Length in Minimum_Length..Maximum_Length > > and (For all C of Password => C in Digit|Upper_Case|Lower_Case|Symbol) > > and Password(Password'First) Lower_Case; > > That's a really nice one. How would the predicate look like if the PW > was to start with a lowercase character? See the modification.