[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnubol: Braiding #1 #2 #3



In a message dated 11/30/99 9:27:15 PM EST, Barticus@att.net writes:

<< 
 WHEN OTHER must be last, bringing up this possibility:
 
 SEARCH
      WHEN
          EVALUATE
              WHEN
              WHEN OTHER
      WHEN
 
 Currently banned by the imperative statement legalism.
  >>

Permit me to tag some of these lines

 SEARCH
      WHEN s1
           EVALUATE
              WHEN e2
               WHEN OTHER eo3
       WHEN s4

There is a chance that the statement is not banned.  The code base is what 
counts. If the vendors are deploying different results we need to make a 
decision about whether we go after that whole base of code.

A simple example we would agree on would be if the WHEN OTHER clause is 
absent, the following code is in trouble 



 SEARCH
      WHEN s1
           EVALUATE
              WHEN e2
       WHEN s4

Any and all parsers will attempt to see WHEN s4 as an EVALUATE's WHEN and 
either get disrupted in s4 or (regretably maybe even parse it silently if the 
header EVALUATE is something like EVALUATE TRUE). That would not be the 
compiler writer's fault.

But back to your example

 SEARCH
      WHEN s1
           EVALUATE
              WHEN e2
               WHEN OTHER eo3
       WHEN s4

A WHEN OTHER cluase can not contain a WHEN clause, thus the WHEN (of WHEN s4) 
is a distinguished token that terminates the WHEN OTHER clause of the 
EVALUATE. EVALUATE's WHEN OTHER cluase, as you point out, must be last. But 
the EVALUATE is not required to have an END-EVALUATE. As the WHEN (of WHEN 
s4) is encountered as lookahead, the WHEN OTHER clause 'reduces', as it 
reduces, so does the EVALUATE. 

Since the WHEN (of WHEN s4) is not a verb, but rather a more distinguished 
token, the WHEN clause (WHEN s4) reduces the WHEN s1 clause, and commences 
its own scope under the SEARCH verb.

This matter seems different then the arithmetic conditional clause discussion 
because the completely ambiguous WHEN token (english meaning) seems to make 
it simply necessary to really impose an explicit scope terminator on the 
internal EVALUATE clause. But that is not how things are.


Replace that bothersome EVALUATE with a nested, and lopsided, IF 
statement,and you will see it differently.

 SEARCH
      WHEN s1
           IF c1
               IF c2
                 IF c3
                    IF c4
                      IF c5
                         DISPLAY 'sad but true
        WHEN s4


In this situation there is not a need for an explicit scope terminator on the 
nested IF statement. The _distinguished_token_WHEN will constitue an implicit 
scope terminator.

In the case of the EVALUATE inside of a SEARCH WHEN clause, the token WHEN is 
insufficient to terminate the EVALUATE statement that does not have a WHEN 
OTHER. 

But if the EVALUATE has a WHEN OTHER clause, then a 'WHEN condition' can 
function as a distinguished token that reduces the WHEN OTHER clause and then 
the internal EVALUATE.

We must be very careful about understanding anything to be banned.  The 
behavior of the compilers and the code base is what matters.

Generally nested conditional statements become imperative, when they are 
either explicitly scope terminated, or when a distinguishd token arives as 
lookahead.

The following are two different types of statements

1)   EVALUATE WHEN...WHEN...WHEN...

2)   EVALUATE WHEN...WHEN...WHEN...WHEN OTHER ...


Statements have type. The token WHEN is not capable of delimiting #1 above, 
indeed it
just glues onto the end. The token WHEN does delimit #2.

The distinguished token WHEN dilimits #2 in exactly the same way that it 
would delimit
a nested if statement.

I realize that these are very different views than some in the group have.  I 
am not advocating
my position.  It is not personal. It is the code base that counts.

Unterminated conditionals along the branches of conditional clauses are 
frequently terminated implicitly by many more things than a period, or an 
explicit scope terminator for the outer conditional statement.

It is most inconvenient, but once we have scanned the WHEN OTHER clause a 
WHEN token definitely teminates the scope of the EVALUATE. It is not banned.  
There is not a requirement to explicitly scope terminate the interior 
conditionals, they frequently can be terminated implicitly.

Best Wishes
Bob Rayhawk
RKRayhawk@aol.com

--
This message was sent through the gnu-cobol mailing list.  To remove yourself
from this mailing list, send a message to majordomo@lusars.net with the
words "unsubscribe gnu-cobol" in the message body.  For more information on
the GNU COBOL project, send mail to gnu-cobol-owner@lusars.net.