1. Goto
- Posted by rforno at tutopia.com
Aug 14, 2001
Igor:
While I was examining your goto proposal, I somehow lost it. Would you be so
kind to resubmit it by private mail to: rforno at tutopia.com ?
Thanks a lot.
2. Goto
Since some people think I should come out of hiding
and voice an opinion on language design proposals,
here's my current thinking about goto.
1. completely general goto, including jumps
between routines: 0% chance
2. goto within a routine: 0.01% chance
3. specialized goto to break out of nested loops: 1% chance
I'm not religiously opposed to goto's. There are some
goto's coded into the C source of the interpreter, and
at one point in the early days I even had one of the
"between routines" gotos that are possible in C using
setjmp()/longjmp(). It proved to be nightmarishly hard
to understand and maintain so I took it out.
I agree that a specialized goto (or special "exit")
to get out of a nested loop is probably less clumsy
than setting up artificial state variables. I just don't think
that this occurs often enough, or causes enough pain
to warrant a new language feature, such as labelled
statements and a special kind of exit.
The normal sort of gotos, that let you jump around within
a routine are like cigarettes. One or two, once in a while,
will not harm you. The trouble is they become addictive.
If you never start using them, you will never have a craving
for one.
When I had to maintain code written by someone
else, the sight of a heavily goto'd section of code would
really be discouraging. The guy who wrote the goto's
probably had some idea of what the control-flow was
supposed to be, but I had to struggle to get the
same picture into my head. Standard control-flow
statements, like for..end for, if-elsif-else etc are much
easier to digest and reason about.
Regards,
Rob Craig
Rapid Deployment Software
http://www.RapidEuphoria.com
3. Re: Goto
- Posted by Roderick Jackson <rjackson at CSIWEB.COM>
Nov 15, 1999
-
Last edited Nov 16, 1999
Robert Craig wrote:
>Since some people think I should come out of hiding
>and voice an opinion on language design proposals,
>here's my current thinking about goto.
>
>1. completely general goto, including jumps
> between routines: 0% chance
Looking at the language, I think anyone would have to
say that that would be the predicted--and logical--
response.
>2. goto within a routine: 0.01% chance
Well, I think I agree with Everett's later statement:
one man's procedure may be larger than somebody else's
whole program. So I don't find this as a shock or a
tragedy either.
>3. specialized goto to break out of nested loops: 1% chance
Interesting; haven't really given this much mental
bandwith yet... I guess I will should this value
start to rise.
>The normal sort of gotos, that let you jump around within
>a routine are like cigarettes. One or two, once in a while,
>will not harm you. The trouble is they become addictive.
>If you never start using them, you will never have a craving
>for one.
Interesting analogy, I'll have to ruminate on
that one. I won't comment on the implications...
>When I had to maintain code written by someone
>else, the sight of a heavily goto'd section of code would
>really be discouraging.
I think that's the main reason those of use who
don't want to see gotos don't want them--even
though we *ourselves* wouldn't abuse them.
If cross-platform portability is enough of an
issue to create a language having it as a central
feature (i.e., Java) then I think forced universal
code clarity is enough of an issue to have a
language having it as a central feature (i.e.,
Euphoria.)
Rod Jackson