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,30df5a909ff1af4,start X-Google-Attributes: gid103376,public From: Richard D Riehle Subject: Answering an Ada/COBOL Question Date: 1999/11/12 Message-ID: <80hr16$5q2$1@nntp5.atl.mindspring.net>#1/1 X-Deja-AN: 547866030 Organization: MindSpring Enterprises X-Server-Date: 12 Nov 1999 19:49:58 GMT Newsgroups: comp.lang.ada Date: 1999-11-12T19:49:58+00:00 List-Id: David Glessner wrote: Richard D Riehle wrote: > Yes, indeed. The COBOL version of a case statement is still the > most elegant design of multiway selection I have seen in any > language. Also, COBOL has adopted some ideas from Ada, although > the COBOL users don' realize it. Care to elaborate for us non-COBOL-aware folks? As briefly as possible, here goes: COBOL uses the word "Evaluate" instead of "case". There are several variations in syntax. I will not cover all of them. Instead, the one that is interesting to me is the "decision table" version. Also, I will code this in a format that does not include some of COBOL's syntactic sugar so it is easy to read. Evaluate A also B also C when True also True also True Perform ... end-perform when True also True also False Perform ... end-perform when False also True also False Perform ... end-perform when others Perform ... end-perform End-Evaluate Note the ease with which one can map a decision table directly to the code. One can argue that this _can_ be expressed just as well in some other language, perhaps Ada. However, the question is never "Is it _expressible_ ?" The real issue is whether how well it can be expressed. It is _expressiveness_ rather than _expressibility_. For the kinds of business data processing problems COBOL is intended to solve, for reducing the communication gap between the client and the programmer, the invention of the Evaluate statement and its variations has improved the level of expressiveness. I once challenged some Ada programmers to come up with an Ada design that would be as expressive as the Evaluate statement. None of the solutions was satisfactory. If you think you have a solution that is as expressive as that in COBOL, be sure you cover all the variations possible, not simply the one I just demonstrated. Richard Riehle http://www.adaworks.com