Re: GoTo in Java




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: Exit Do
    ... I've been instructed by a dot net / asp programmer that Exit Do is ... I am using nested loops and need to exit out of one loop into ... Code Stage B ...
    (microsoft.public.scripting.vbscript)
  • Re: for loops
    ... I personally would never use a FOR ENDFOR loop for something that I do not ... and such constructs lets one think the programmer wasnt able to create ... > regardless of which programming-language i worked in. ... > Using EXIT breaks the structured program-flow. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: GoTo in Java
    ... the "in-line" PERFORM does NOT have a label. ... syntax of the inline PERFORM statement from which you want to EXIT? ... I think labelled EXIT PERFORM would raise more problems than ... > loops to be labelled, and the loop terminator would have to specify ...
    (comp.lang.cobol)
  • Re: how do people feel about exit function from loop
    ... or exit for then the code becomes less readable. ... Only to someone who's not used to that coding style. ... it was a very simple loop. ... any programmer thinking of taking over ...
    (microsoft.public.vb.general.discussion)
  • Re: Infinite Loops and Explicit Exits
    ... > CS> One of these proposals relaxes the current restriction that an EXIT ... > termination of the loop is not visible at that point. ... > terminating condition is visible in that context. ... > You now want to allow this remote procedure, ...
    (comp.lang.cobol)