Sign in to follow this  
Followers 0
GodForsakenSoul

this always bugged me :P

17 posts in this topic

one thing always bugged me about any programing language: why do EVERYONE HATE the goto thing?

it works pretty nicely o.O

i never use it to have my dignity though.

i don't hate it, but everyone else seems to hate the goto thing and everyone who use it.

Share this post


Link to post
Share on other sites



The problem with Goto is the ease with which a novice, or even an experienced, programmer can make very convoluted programs which get exponentially more difficult as the program gets bigger. Look up spaghetti code on Wikipedia for some ideas about this. Debugging or maintaining a program full of Gotos is a lot more difficult than one that uses a structured programming language, like AutoIt 3. Because part of our focus was to make a language that was easy to learn, goto's were chucked so that people could more easily debug their scripts. Also, using structured programming allows tools like Tidy (part of the AutoIt SCite editor) to organize the structure and easily find when structures get out of hand.

I hope this helps.


David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites

Correction, goto was never implemented to be removed. Since AutoIt 3 was a rewrite from scratch, Jon didn't even implement goto.

Share this post


Link to post
Share on other sites

V2 != V3. V3 is not a superset of V2 like C++ is of C. V3 was a brand new product designed from the ground up.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

--

Edited by AL3X

Share this post


Link to post
Share on other sites

one thing always bugged me about any programing language: why do EVERYONE HATE the goto thing?

it works pretty nicely o.O

i never use it to have my dignity though.

i don't hate it, but everyone else seems to hate the goto thing and everyone who use it.

Get a job maintaining RPG code on AS/400. You will probably learn to hate it to..:)

Share this post


Link to post
Share on other sites

Get a job maintaining RPG code on AS/400. You will probably learn to hate it to..:)

Or over 30,000 lines of Fortran written in spaghetti code.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

I read somewhere that goto is mostly used to break more than one loop when not being used in a beginner fashion. A real programmer could make sentinels to continue breaking loops if more than one break was needed.

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

From what I've seen goto is mostly used to jump to cleanup code at the end of a function. However, my experience seeing goto in use is from Microsoft examples or Microsoft generated code. I don't use goto, of course, so I simulate the same idea using a for(;:) loop which I conditionally break out of on error and unconditionally break out of after one complete loop. The advantage to this is C++ destructors are correctly invoked and it still only requires the cleanup code to be in one place and it's easy to jump to the cleanup using a break statement.

Edit: I use the same technique and have shown an example a couple times on the forum, as well.

Edited by Valik

Share this post


Link to post
Share on other sites

Goto Reminds me of my days in TI-Basic aha...


[center][/center]

Share this post


Link to post
Share on other sites

I read somewhere that goto is mostly used to break more than one loop when not being used in a beginner fashion. A real programmer could make sentinels to continue breaking loops if more than one break was needed.

We have implemented multiple level ContinueLoop and ExitLoop to accommodate this. No need for goto here. :)

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites

Well, I was referring to languages with only a static "break" statement.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0