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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: I am not understanding user defined exceptions Date: Sat, 04 Feb 2017 08:41:30 +0000 Organization: A noiseless patient Spider Message-ID: References: <6cb6e781-c6df-4962-99e3-760e7c7fab88@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="6ca5cb3a56576060adb6aca67dc15486"; logging-data="16314"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+zm2jRaBv6lLJykIqY/OmcIG/JtHG3LmE=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (darwin) Cancel-Lock: sha1:RVQQKYDRTpXRSCHZ9kHpUkV9YpA= sha1:OF4AY2Zv0R3yNCDF2MuOemvR4HM= Xref: news.eternal-september.org comp.lang.ada:33239 Date: 2017-02-04T08:41:30+00:00 List-Id: You are thinking of user-defined *predicates* (properties of values of the type), available in Ada2012. Try subtype Not_One is Integer with Dynamic_Predicate => Not_One /= 1; X : Not_One; (with GNAT, you have to enable assertion checking, compile with -gnata) $ ./test_exceptions 2 1 raised SYSTEM.ASSERTIONS.ASSERT_FAILURE : Dynamic_Predicate failed at test_exceptions.adb:9 (line 9 is the second Get)