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,47def5aa7b3182bd X-Google-Attributes: gid103376,public From: tmoran@bix.com (Tom Moran) Subject: Re: How to write TYPECASE in Ada 95? Date: 1999/02/19 Message-ID: <36cdb012.580716@news.pacbell.net>#1/1 X-Deja-AN: 446149329 References: <79fct8$9k3$1@murdoch.acc.Virginia.EDU> <1103_918264881@DZOG-CHEN> X-Complaints-To: abuse@pacbell.net X-Trace: typhoon-sf.pbi.net 919450223 207.214.215.90 (Fri, 19 Feb 1999 10:50:23 PDT) Organization: SBC Internet Services NNTP-Posting-Date: Fri, 19 Feb 1999 10:50:23 PDT Newsgroups: comp.lang.ada Date: 1999-02-19T00:00:00+00:00 List-Id: >>> I thought a good part of the point of tagged types >>> (and support for polymorphism in other OOP's) was >>> exactly to avoid this kind of code. (series of if-elsif) >>Dispatching is certainly better than a case statement - if you use it. >>Consider an existing package of the form: (example of dispatching being inappropriate) >tmoran@bix.com (Tom Moran) writes: >> Dispatching is certainly better than a case statement - >> if you use it. >I strongly disagree with this statement. This particular >bit of conventional wisdom is badly in error, and can lead >to unnecessarily obscure hard to maintain programs. >Case statements and dispatching represent two ways of I see you strongly agree that dispatching is not always the solution, and a case statement, for instance, is more appropriate. But in the situation at hand, the only thing apparently available is the original poster's original if-elsif list, with the usual hazards of left out or overlapping cases. Was something like Modula 3's "Typecase" considered for Ada 95? Are there problems with it?