Re: GoTo in Java
- From: "Chuck Stevens" <charles.stevens@xxxxxxxxxx>
- Date: Thu, 19 Jan 2006 12:58:47 -0800
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
.
- Follow-Ups:
- Re: GoTo in Java
- From: Michael Wojcik
- Re: GoTo in Java
- References:
- GoTo in Java
- From: Howard Brazee
- Re: GoTo in Java
- From: Peter Lacey
- Re: GoTo in Java
- From: Howard Brazee
- Re: GoTo in Java
- From: Tiberiu Gociu
- Re: GoTo in Java
- From: Howard Brazee
- Re: GoTo in Java
- From: Chuck Stevens
- Re: GoTo in Java
- From: Michael Wojcik
- GoTo in Java
- Prev by Date: Re: GoTo in Java
- Next by Date: Re: GoTo in Java
- Previous by thread: Re: GoTo in Java
- Next by thread: Re: GoTo in Java
- Index(es):
Relevant Pages
|