[Info-vax] Fortran

Arne Vajhøj arne at vajhoej.dk
Thu Dec 6 20:16:59 EST 2018


On 12/6/2018 1:46 AM, Dave Froble wrote:
> On 12/5/2018 10:07 PM, Arne Vajhøj wrote:
>> On 12/5/2018 9:12 PM, Dave Froble wrote:
>>> On 12/5/2018 9:00 PM, Arne Vajhøj wrote:
>>>> On 12/5/2018 8:23 PM, Bill Gunshannon wrote:
>>>>> On 12/5/18 1:29 PM, Scott Dorsey wrote:
>>>>>> Didn't Knuth say that global variables should be banned?
>>>>>
>>>>> And Dijkstra said GOTO's should, too.  How did that work out?
>>>>
>>>> Pretty well.
>>>>
>>>> Many newer languages does not have GOTO.
>>>>
>>>> And in those newer languages that does have it, then
>>>> its usage is typical extremely rare.
>>>
>>> We must exist in different worlds ...
>>
>> You see a lot of code in languages like C# and PHP use GOTO??
> 
> I like to have well defined exit points.  So in just about everything I 
> write, if for no other purpose, there is most likely a GoTo to the exit 
> point.
> 
> If I have a program with multiple sections, while there are various 
> methods to dispatch to selected sections, GoTo is a quite valid method.
> 
> I will mention that I avoid GoTo to implement logic and such, which is 
> where the problems arise.
> 
> I really like two things is code.  Simplicity and structure.

I was just trying to illustrate that the campaign against GOTO
certainly have produced some results.

Java, Python, JavaScript, Swift and Rust does not have GOTO at all.

C#, PHP, Ruby and Go do have GOTO but they are rarely used.

I believe that is a significant change from the situation when
Dijkstra wrote that. GOTO has become an endangered species.

I think you are raising a different question: is GOTO really
bad as in always bad.

I don't think so. There are cases where GOTO is a good
way to manage flow. I have frequently used it in C.

But the need for such is significantly reduced in newer
languages with exceptions, labeled break and other
constructs.

Arne




More information about the Info-vax mailing list