comp.lang.ada
 help / color / mirror / Atom feed
From: Brian Rogoff <bpr@shell5.ba.best.com>
Subject: Re: Answering an Ada/COBOL Question
Date: 1999/11/13
Date: 1999-11-13T00:00:00+00:00	[thread overview]
Message-ID: <Pine.BSF.4.10.9911131710530.16406-100000@shell5.ba.best.com> (raw)
In-Reply-To: 80hr16$5q2$1@nntp5.atl.mindspring.net

On Fri, 12 Nov 1999, Richard D Riehle wrote:
> 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

I don't want to rain on your parade, but how is this nicer than the
pattern matching capability that all modern functional programming 
languages have? Not only can they match on product types, like your 
bool * bool * bool tuple, but they can match on lists, records, 
and sum types. That seems far more elegant than the COBOL snippet above.
Am I missing something?

> 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_.   

match(a,b,c) with 
  (true,true,true)  -> foo
| (true,true,false) -> bar
| (true,false,false) -> baz
| (_,_,_)            -> default

seems perfect to me, but I don't know COBOL. Is there some other aspect of 
COBOL's conditional that gives it more expressiveness than what you've 
shown?

-- Brian (OCaml fan, and Ada fan too ;-)







  reply	other threads:[~1999-11-13  0:00 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-12  0:00 Answering an Ada/COBOL Question Richard D Riehle
1999-11-13  0:00 ` Brian Rogoff [this message]
1999-11-14  0:00   ` Robert Dewar
1999-11-13  0:00     ` Brian Rogoff
1999-11-14  0:00       ` Robert Dewar
1999-11-14  0:00         ` Brian Rogoff
1999-11-15  0:00           ` Richard D Riehle
1999-11-15  0:00             ` Brian Rogoff
1999-11-16  0:00               ` Robert Dewar
1999-11-16  0:00               ` Erlang (Was Re: Answering an Ada/COBOL Question) Vladimir Olensky
1999-11-16  0:00                 ` Vladimir Olensky
1999-11-17  0:00                   ` Samuel Tardieu
1999-11-19  0:00                     ` Robert Dewar
1999-11-22  0:00                       ` Samuel Tardieu
1999-11-22  0:00                         ` Brian Rogoff
1999-11-17  0:00                 ` Samuel Tardieu
1999-11-18  0:00                   ` Robert Dewar
1999-11-19  0:00                     ` Vladimir Olensky
1999-11-19  0:00                   ` Vladimir Olensky
1999-11-16  0:00             ` Answering an Ada/COBOL Question Robert Dewar
1999-11-16  0:00               ` Richard D Riehle
1999-11-18  0:00                 ` Robert Dewar
1999-11-18  0:00                   ` Marin Condic
1999-11-19  0:00                     ` Robert Dewar
1999-11-19  0:00                       ` Marin Condic
1999-11-19  0:00                         ` Robert Dewar
1999-11-18  0:00                   ` tmoran
1999-11-19  0:00                     ` Robert I. Eachus
1999-11-15  0:00 ` Joseph P Vlietstra
1999-11-15  0:00   ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox