Re: GoTo in Java



If you're restricting "labelled EXIT PERFORM" to *inline* PERFORM
statements, it seems to me that the distinction between a "labelled" PERFORM
and an "unlabelled" PERFORM is precisely that the former has at least one
label, and that in turn identifies it as an *out-of-line* PERFORM, whereas
the "in-line" PERFORM does NOT have a label.

Taking the simplest cases:

PERFORM X. *> out-of-line PERFORM
PERFORM (statements from paragraph or section X) END-PERFORM. *> inline
PERFORM

Given that the "label" of a "labelled inline PERFORM" can't go after the
keyword PERFORM (otherwise it's a label already!), how do you propose to
differentiate a "labelled inline PERFORM" from an "out-of-line PERFORM"?

>From the other side, if what you want to do is "EXIT PERFORM IT", what's the
syntax of the inline PERFORM statement from which you want to EXIT? Where
does "IT" go in the PERFORM statement, given that "PERFORM IT." is a valid
statement if IT is a paragraph-name or a section-name? I only see one
place for the "label" of a "labelled PERFORM", and that's immediately after
the keyword.

The only way I see to do this is to differentiate "PERFORM IT CONTINUE."
from "PERFORM IT CONTINUE END-PERFORM", and in the case that "IT" exists as
a paragraph-name or section-name in the program, that leads to the two
statements doing two ENTIRELY different things. I don't think that's such a
terrific idea, frankly!

COBOL *has* labelled loops, so long as you use out-of-line PERFORM!

-Chuck Stevens


"Michael Wojcik" <mwojcik@xxxxxxxxxxx> wrote in message
news:dqor0j0237t@xxxxxxxxxxxxxxxxxxxx
>
> In article <dqlv91$or$1@xxxxxxxxxxxxxxxxxxxx>, "Chuck Stevens"
> <charles.stevens@xxxxxxxxxx> writes:
>>
>> Personally, I think labelled EXIT PERFORM would raise more problems than
>> it
>> would solve.
>
> If it was restricted to inline PERFORM, I don't see any problem; that
> is, it doesn't seem to me to be any more pernicious than the average
> construct now available. Certainly it can be abused, but what can't?
>
> I'll note that labelled break and continue in Java have not caused
> any particular grief in that language. (Frankly, as far as code
> readability goes, I think Java's worst problem is the inclination
> among many of its practitioners to write lines of a hundred
> characters or so. The whitespace shortage is over, folks.)
>
>> Even EXIT PERFORM <integer>, where <integer> is the number of
>> levels to "exit", might be easier to define and less prone to errors
>
> That's worse, IMO, because it's fragile. If code is refactored and a
> level is added or removed to a nested PERFORM with a multilevel EXIT
> PERFORM, then that magic number is suddenly wrong.
>
> And numbered EXIT PERFORM is just labelled EXIT PERFORM with
> potentially meaningful labels dropped in favor of forcing the code
> maintainer to count levels. Make the compiler do the work, not the
> programmer.
>
> (If I were writing a language, actually, I think I'd require *all*
> loops to be labelled, and the loop terminator would have to specify
> the label. If the programmer is putting in a loop, it should be a
> loop over something; let's make that explicit.)
>
> --
> Michael Wojcik michael.wojcik@xxxxxxxxxxxxxx
>
> Thanks for your prompt reply and thanks for your invitatin to your
> paradise. Based on Buddihism transmigration, I realize you, European,
> might be a philanthropist in previous life! -- supplied by Stacy Vickers


.



Relevant Pages

  • Re: GoTo in Java
    ... I think labelled EXIT PERFORM would raise more problems than it ... loops to be labelled, and the loop terminator would have to specify ... If the programmer is putting in a loop, ...
    (comp.lang.cobol)
  • Re: Is there a break or continue in Do Unitl... Loop?
    ... now i used a label with GoTo clause. ... The exit do takes it to the line immediately following the loop line. ...
    (comp.databases.ms-access)
  • Re: PL/I, COBOL, Advantages, Equivalence, et al
    ... label to accomplish early exit from a ... loop. ... look up ITERATE statement. ...
    (comp.lang.pl1)
  • Re: GoTo in Java
    ... You can leave the inner loop with "EXTIT PARAGRAPH" and the next one ... it has a label and a GoTo equivalent to tell us how to exit a ... The label in Java tells the loop within loop within loop within loop ... how far to exit. ...
    (comp.lang.cobol)
  • Re: On Local Error Goto Somewhere
    ... an EXIT DO or EXIT FOR. ... going if there is no label to show you the destination. ... IMO the GoTo statement has never been "THE" problem. ... ON ERROR GOTO MySubErr Dim lFNbr as long ...
    (microsoft.public.vb.general.discussion)