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 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Georg Bauhaus Newsgroups: comp.lang.ada Subject: Re: type conversion Date: Mon, 13 Oct 2014 01:05:53 +0200 Organization: A noiseless patient Spider Message-ID: References: <8d412a6d-5589-4601-a7f8-5bb6d1b8850f@googlegroups.com> <1413106638.3344.5.camel@obry.net> Reply-To: nonlegitur@futureapps.de Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 12 Oct 2014 23:05:54 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="54d78b013939928e98c1bc2e2fbf0865"; logging-data="25361"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Pcquimh1DdFUzeXaxIy1/J8hPklZEGQ4=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: <1413106638.3344.5.camel@obry.net> Cancel-Lock: sha1:6LwlpH6oYpN3/T5Y9Shg9h0jJHE= Xref: news.eternal-september.org comp.lang.ada:22405 Date: 2014-10-13T01:05:53+02:00 List-Id: On 12.10.14 11:37, Pascal Obry wrote: > To control the message or the exception to be raised one can use the > Predicate_Failure aspect: > > subtype Integer_String is new String > with Dynamic_Predicate => Integer'Value (Integer_String) in Integer, > Predicate_Failure => "not an integer string"; Is Predicate_Failure a new aspect in GNAT? My RM does not list it, and GNAT GPL 2014 rejects it. GNAT does, however, accept subtype Integer_String is String with Dynamic_Predicate => Integer'Value (Integer_String) in Integer or else raise Assertion_Error with "not an integer string"; (And warns that one should use 'Valid instead of a membership test, even though there is no object to which one could apply 'Valid.)