1. In defense of GOTO and GOSUB

I have always felt that the rejection of the GOTO and GOSUB was at best illogical and uncalled for. Here are some reasons:

In all Assemblers I have come across the altering of program flow is a built in function.
You have Assembler instructions such as
JMP - an unconditional GOTO
JZ or JPZ - GOTO if zero flag set
JC or JPC - GOTO if carry flag set
and many more.

You have Assembler instructions such as
CALL - an unconditional GOSUB
CALLZ - GOSUB if zero flag set
CALLC - GOSUB if carry flag set
and many more.

In fact, in Assembler this is very often used in large projects.
To complicate matters in Assembler, a lot of programming is done using the STACK for passing values to the called program, jeopardizing the RETURN location if one is not careful in the called program. In my work, I never used the stack for passing values, thus avoiding the disaster of going to wrong location at RETURN. However, I see that in the current use of Assembler, use of STACK to pass values is not only the norm but actually encouraged.

How does this apply to Euphoria?
Euphoria has rejected GOTO AND GOSUB.
However, CALL BACKs are used. I came across this article which essentially says:
"Callbacks are the modern GOTO"
"Just like goto, these callbacks force you to jump around your codebase in a way that is really hard to understand. You basically have to read the whole program to understand what any individual function does."

For the full article GOTO http://elm-lang.org/learn/Escape-from-Callback-Hell.elm

new topic     » topic index » view message » categorize

2. Re: In defense of GOTO and GOSUB

EUWX said...

How does this apply to Euphoria?
Euphoria has rejected GOTO AND GOSUB.

I'm not sure what you're talking about. 4.0 added goto. And the structured programming answer to GOSUB is the routine. We have three different kinds of routines.

Matt

new topic     » goto parent     » topic index » view message » categorize

3. Re: In defense of GOTO and GOSUB

mattlewis said...
EUWX said...

How does this apply to Euphoria?
Euphoria has rejected GOTO AND GOSUB.

I'm not sure what you're talking about. 4.0 added goto. And the structured programming answer to GOSUB is the routine. We have three different kinds of routines.

Matt

Sorry. My fault.
I was looking only at branching section, when I should have looked at flow control part of the manual.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu