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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,715875e575230543 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-21 23:59:44 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!skynet.be!skynet.be!freenix!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: christoph.grein@eurocopter.com Newsgroups: comp.lang.ada Subject: Re: Thought this was funny Date: Wed, 22 Oct 2003 08:44:44 +0200 (MET DST) Organization: Cuivre, Argent, Or Message-ID: Reply-To: grein@egypt.otn.eurocopter.de NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-Trace: melchior.cuivre.fr.eu.org 1066805910 55970 80.67.180.195 (22 Oct 2003 06:58:30 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Wed, 22 Oct 2003 06:58:30 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: X-Authentication-Warning: mail.eurocopter.com: uucp set sender to using -f Content-MD5: y14Ww4VSJH89/tfQRdNxoA== X-Mailer: dtmail 1.2.1 CDE Version 1.2.1 SunOS 5.6 sun4u sparc X-Virus-Scanned: by amavisd-new-20030616-p5 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Gateway to the comp.lang.ada Usenet newsgroup List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:1372 Date: 2003-10-22T08:44:44+02:00 > case is > when true => > > > when false => > > > end case; What's so funny about this code. I also normally use if-statements with booleans but there are circumstances where a case statement seems more appropriate to the problem at hand. Take e.g. kind of double-buffering. I use an array indexed by Boolean and switch via "X := not X;" In such cases, neither True nor False denote something which is wrong or right, so I prefer the case statement. Switching with a two-valued enumeration is not so elegant, you need a switch table or a case statement instead of the simple "X := not X;". [Ducking away because this is an abstraction inversion :-]