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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,74a56083ffbe573d X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: Zoo question Date: 1996/08/16 Message-ID: #1/1 X-Deja-AN: 174680930 references: <320F16B6.6944@lmtas.lmco.com> <4v0pme$c56@newsbf02.news.aol.com> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-08-16T00:00:00+00:00 List-Id: John Herro said " I realize that the point of this thread is to discuss the raising and handling of Constraint_Error, but I think for the sake of any beginners reading comp.lang.ada, we should point out the general rule not to use an exception handler where a simple "if" will do. Thus, I think most people will agree that the above could better be written if Next_Animal = Animal_ID'Last then Next_Animal := Animal_ID'First; else Next_Animal := Animal_ID'Succ(Next_Animal); end if;" Actually this is nice application for a modular type, just make the type be mod 5, then you just do the Succ call and it works fine. No if needed, no test needed.