Jump to content

Talk:Goto

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
(Redirected from Talk:GOTO)

Help Here!

[edit]

Can someone please explain the goto relation to object oriented programing specifically? It seems that it is a compromise between pro and con beliefs on using goto, but that is (my) layman's conjecture. Thanks! — Preceding unsigned comment added by 71.99.3.105 (talk) 23:58, 30 June 2011 (UTC)[reply]

Java and Goto

[edit]

Because of the current popularity of Java, would it be appropriate to discuss the labeled break and labeled continue statements in this article? It has always seemed to me that these constructs, though rarely used, are gotos with restrictions as to where you can "go to". --Eraticus 23:12, 16 April 2007 (UTC)[reply]

The Complete Framework for Using Gotos in Java Programs

[edit]

Does this belong here? Looks like a commercial promotion to me. Any other comments? (Personal POV: I mean apart from the bizzare idea of porting Fortran to Java without rewriting it; this is a joke, right?; the idea that adding jumps to Java would help; the idea that you would actually have something bug free at the end of it; the amazing amount of effort and hacks to get this into Java; why not leave it in fortran? (End personal POV) peterl 03:59, 6 July 2007 (UTC)[reply]

Assembly

[edit]

The article is missing a section on GOTO in assembly language. In assembly (eg PIC ASM), there are no high-level constructs such as for/if-then-else/break etc. There are only: Call/Return, Goto (=Jump) and Conditional Jump (eg the pic's skipz/skipnz). Things such as if-elseif-else are built out of conditional jumps: practically every flow-control structure in assembly is a Goto. --RichardNeill 05:30, 24 July 2007 (UTC)[reply]

Well, in assembly there is no distinction between goto and non-goto branching. This is a distinction that can only made in higher level languages that have alternatives to "goto". Why would we need to cover "goto in assembly"? It's not even referred to as goto in assembly language. - Rainwarrior 05:51, 24 July 2007 (UTC)[reply]

Requested move

[edit]
The following discussion is an archived discussion of the proposal. Please do not modify it. Subsequent comments should be made in a new section on the talk page. No further edits should be made to this section.

The result of the proposal was Move. Although the (Fortran) tradition is there, I don't see a compelling reason to override MOS:CAPS; the command is genericized enough in many programming languages. See also Category:Control flow.

  • Strong Oppose - Just because a few modern languages are case sensitive doesn't mean that the article should default to that usage, contrary to a wider and historical usage. Instead Goto should redirect to GOTO. Note also that the command is capitalised throughout the article. And wikt:GOTO is about the command. wikt:goto is not. - jc37 09:23, 7 October 2007 (UTC)[reply]
I did make that redirect. I am not arguing for case-sensitivity - rather, the title should not be, and therefore should use normal Wikipedia conventions to prefer lowercase. The former title of this page, Goto (command), is lowercase. Goto and GOTO simply mean the same thing. The way, the truth, and the light 22:52, 7 October 2007 (UTC)[reply]
No they aren't necessarily the same, per the wiktionary links I listed above. - jc37 20:27, 12 October 2007 (UTC)[reply]
The above discussion is preserved as an archive of the proposal. Please do not modify it. Subsequent comments should be made in a new section on this talk page. No further edits should be made to this section.

NPOV mark on critcism section

[edit]

The criticism section had been marked with NPOV. But no explanation was given. The section is well referenced, and the fact that is is criticism doesn't make it POV. Please explain if you want to add that marker back in. peterl (talk) 04:19, 29 January 2008 (UTC)[reply]

I don't think the NPOV tag was warranted either, but the writing was a bit awkward and did have a weasel word tag. I've tried rewriting several of the sentences to try to make it better. - Dmeranda (talk) 09:44, 29 January 2008 (UTC)[reply]

A working GOTO for Python

[edit]

It was written as an April fool's joke, it works and includes a "comefrom" statement, but there is REALLY no need for it in the language ;)

http://entrian.com/goto/

A working GOTO for Java

[edit]

An open-source licensed project called JavaGoto. Maybe it has some usefulness in teaching (what GOTO is and why not to use it). https://github.com/footloosejava/JavaGoto — Preceding unsigned comment added by 174.7.38.170 (talk) 04:22, 18 April 2014 (UTC)[reply]

It's GO TO in COBOL

[edit]

Since there seems to be much ado over GOTO vs GoTo, goto, gOTo, etc., it must be important, so I think there should be some mention of the COBOL form being two words. Georget99 (talk) 20:14, 10 April 2009 (UTC)[reply]

That's not the only occurrence of GO TO. Commodore BASIC accepts both forms: GOTO is tokenized as 0x89; GO TO is tokenized as 0xCB 0xA4. Both forms are interpreted in exactly the same way. Devil Master (talk) 20:41, 28 July 2009 (UTC)[reply]

Linus Torvalds

[edit]

Why on earth are we citing Linux Torvalds as an authority on this particular aspect of computer science? I've removed an extensive verbatim quote of an email he supposedly once sent to the kerneltrap mailing list (!). --TS 18:41, 11 December 2009 (UTC)[reply]

Linus is a experienced programmer, widely recognised in the computer sciences (NOTABILITY) - please check the wiki article on him for details. He IS an authority when it comes to programming, both C and machine code~, same can be said about his posts on kerneltrap. Also, his views represent a unorthodox stance vs goto usage, contrasting with what most "wannabe specialists" want to believe; representing every important view on the subject, regardless of Your personal preferences, was one of the main Wikipedia ideas. Either edit the form of the article or accept what's fact. DON'T DELETE just because you don't understand it, monopolizing an article is an extreme example of bad taste. Vaxquis (talk) 15:51, 30 January 2010 (UTC)[reply]
Torvalds is an experienced programmer, certainly, but you still don't explain why his opinion belongs in this article. He's an operating system kernel developer, not a language designer. Why is his opinion (which is tucked away in some posting on the Linux Kernel Mailing List) in this article? The mere fact that he has an opinion does not explain that. The mere fact that he has written operating system kernel code in C does not explain that. Can you explain that? --TS 17:03, 30 January 2010 (UTC)[reply]
because he's not a *theoretician*, but a notable programmer dealing with practical aspects of code creation. drawing the proper line between theory and practice in IT is obviously important, and he clearly shows the point that was clearly visible in older revisions of the page, dating up to 2001 (http://en.wikipedia.org/w/index.php?title=Goto&oldid=255242) - that gotos may be and often are a reasonable choice in programming. feel free to replace Torvalds' quote with any other *well known software designer's* or *notable programmer's* quote, stating what Torvalds said with as little words and so much precision as he did - i won't object to this, the choice of Linus (*not* Linux - you've made a typo there, mate) was made a priori, just because he fits perfectly for a person to state the unobvious obviousness of the usefulness and harmlessness of gotos... i'd say even more - throw out the quote if you feel that it doesn't clarify the point of the preceding statement; but AFAIR wikipedia is not encyclopedia - if we feel that Linus point of view on programming is unimportant just because he hasn't won the Turing Award, we may as well ditch Bill Gates and Eric S. Raymond's opinions on CS & IT for being worthless because the haven't the Neumann Medal. but, if you still insist:
  • In 1997 he received his Master degree (Laudatur Grade) from Department of Computer Science, University of Helsinki.
  • In 1998 he received an EFF Pioneer Award.[24]
  • In 1999 he received honorary doctor status at Stockholm University.
  • In 2000 he received honorary doctor status at University of Helsinki.[25]
  • In 2000 he was awarded the Lovelace Medal.[26]
  • In the Time magazine's Person of the Century Poll, Torvalds was voted at #17 at the poll's close in 2000.[27]
  • In 2001, he shared the Takeda Award for Social/Economic Well-Being with Richard Stallman and Ken Sakamura.
  • In 2004, he was named one of the most influential people in the world by the Time magazine article "Linus Torvalds: The Free-Software Champion" by Lawrence Lessig[28]
  • In the search for the 100 Greatest Finns of all time, voted in the summer of 2004, Torvalds placed 16th.
  • In August 2005, Torvalds received the Vollum Award from Reed College.[30]
  • In 2006, Time Magazine—Europe Edition named him one of the revolutionary heroes of the past 60 years.[32]
  • In 2008, he was inducted into the Hall of Fellows of the Computer History Museum in Mountain View, California.[33][34]
please do some research on these awards... Linus Torvalds simply IS somebody notable enough in CS for his opinions to matter. is that enough to meet your nota' criteria or should i search for more? Vaxquis (talk) 22:23, 30 January 2010 (UTC)[reply]
I don't think you need to use sarcasm, and in reference to your latest edit summary on this page, of course I'm prepared to wait for a response, so don't worry. I'm not asking you to give me a rundown of Torvalds' career. I'm asking you specifically what his opinion on the use of the goto, as expressed in a fairly obscure mailing list, is doing in this article. Why is it relevant? Citing these awards and whatnot does not go towards answering the question. --TS 22:32, 30 January 2010 (UTC)[reply]
QUOTE: because he's not a *theoretician*, but a notable programmer dealing with practical aspects of code creation. drawing the proper line between theory and practice in IT is obviously important, and he clearly shows the point that was clearly visible in older revisions of the page, dating up to 2001 (http://en.wikipedia.org/w/index.php?title=Goto&oldid=255242) - that gotos may be and often are a reasonable choice in programming. feel free to replace Torvalds' quote with any other *well known software designer's* or *notable programmer's* quote, stating what Torvalds said with as little words and so much precision as he did - i won't object to this, the choice of Linus (*not* Linux - you've made a typo there, mate) was made a priori, just because he fits perfectly for a person to state the unobvious obviousness of the usefulness and harmlessness of gotos.
if you need me to Ctrl+C Ctrl+V it a couple of times more, i'm always eager to help. just read it aloud, it's the exact answer to your exact question. if you don't see my point, just ask somebody [who?] to explain it to you - some [which?] people are better than me at explaining obviousness... Linus maybe?
I read it the first time. Could you now explain why you consider Linus Torvalds to be an authority on programming languages? It's all I want to know. --TS 11:14, 31 January 2010 (UTC)[reply]
Ctrl+C Ctrl+V

if you still insist: In 1997 he received his Master degree (Laudatur Grade) from Department of Computer Science, University of Helsinki. In 1998 he received an EFF Pioneer Award.[24] In 1999 he received honorary doctor status at Stockholm University. In 2000 he received honorary doctor status at University of Helsinki.[25] In 2000 he was awarded the Lovelace Medal.[26] (...) In 2004, he was named one of the most influential people in the world by the Time magazine article "Linus Torvalds: The Free-Software Champion" by Lawrence Lessig[28] (...) In August 2005, Torvalds received the Vollum Award from Reed College.[30] In 2006, Time Magazine—Europe Edition named him one of the revolutionary heroes of the past 60 years.[32] In 2008, he was inducted into the Hall of Fellows of the Computer History Museum in Mountain View, California.[33][34] please do some research on these awards...

they aren't given to random people with no knowledge of CS, and they are given to people both widely respected, acknowledged and influential. isn't that enough for someone's opinion on the subject to be notable enough to matter?

http://en.wikipedia.org/wiki/Wikipedia:Notability_(people)

it's quite easy to prove Linus Torvalds' notability in the field of programming. developing and maintaining the world's most known free-source operating system should be enough by itself;

so please, either prove that Torvalds SHOULD'T be considered an authority when it comes to CS in his field of interest (and low-level programming is DIRECTLY related to GOTO use - PLEASE do the research on your own, because the relation it's quite obvious to anybody with a basic knowledge of assembler/C/kernel programming), or declare the dispute closed.

I don't subscribe to the notability guideline precisely because it's so often misused (as it is here). In my opinion the statement of Torvalds, given off-the-cuff on a website devoted to kernel development in C, fits poorly with the scholarly opinions of Knuth and Dijkstra. The main problem, however, was an extensive verbatim quote (including email headers) from that email, which far outbalanced the entire section. I've remedied that problem and I'll leave it there. --TS 18:40, 31 January 2010 (UTC)[reply]


GOTO - isn't "break" and "continue" just an internal goto ( compiler supplies the label). Is a pointer a calculated goto ( ie GOTO variable - really old construction, apparently abandoned because it causes as much problems as pointers) —Preceding unsigned comment added by 159.105.80.141 (talk) 13:14, 19 May 2010 (UTC)[reply]

The referenced person is clearly used as an example which is helpful. Besides without links/ references everything would have to be fully explained (Ctrl+C , Cntrl+V) on every wiki page. This point/ argument is isomorphic to the article's argument on goto's controversy, and that is quite cute.

Unconditional

[edit]

Goto should be described as an unconditional jump. A plain goto is not a branching statement. Only if goto is preceded by an if (or similar) it works in a conditional way. (or if it's a computed goto or any of the more exotic variants) — Preceding unsigned comment added by 88.112.175.168 (talk) 08:05, 25 September 2011 (UTC)[reply]

Sorry, but that's nonsense steeped in pedantry. If you want to make a distinction between conditional branching and unconditional branching do so, but both forms of branching are still branching nonetheless.Tgm1024 (talk) 16:07, 28 July 2014 (UTC)[reply]

Criticism and Decline

[edit]

Regarding the request for citations starting:

Some[which?] programming style coding standards prohibit...

Possible citations are

[1] "It is good programming style to use the break, continue, and return statement in preference to goto whenever possible."

[2] "Chapter 7: Centralized exiting of functions

Albeit deprecated by some people, the equivalent of the goto statement is used frequently by compilers..."

The python discussion about a Python goto is quite interesting [3] "This PEP is not a proposal to add GOTO to Python. GOTO allows a programmer to jump to an arbitrary block or line of code, and generally makes control flow more difficult to follow."

It might be helpful to rephrase the sentence:

Some programming style coding standards discourage... while some do not

ProgrammerMax (talk) 20:40, 6 April 2012 (UTC)[reply]

References

If the only reason why "goto" should not be use, is that the program can not be checked : it's not a good reason : optimized code is necessarily hard to check. Code is not designed to be checked, but to be the fastest and the shortest : with the best reuse of instruction, and the less redundancy of tasks (such as done/undone/done/undone). Goto is simply necessary. — Preceding unsigned comment added by 137.129.13.90 (talk) 16:18, 11 September 2012 (UTC)[reply]

Dijkstra didn't propose the title "goto considered harmful", it was Niklaus Wirth

[edit]

Dijkstra claims that "goto considered harmful" was not the original title of his article. The title was changed by the editor, Niklaus Wirth.

Dijkstra tells the story in this video beginning at 4:22: http://www.youtube.com/watch?v=40CNRVHLt7A&feature=player_detailpage&list=PL7D42CB0A207D79B6#t=255s Prof. Edsger Dijkstra on "Structured Programming" at "Software Pioneers",sd&m Conference 2001, Bonn, Germany

I don't have time to transcribe the story now but it would be a good addition (and correction) to this article.

I haven't read the "considered harmful" paper in a while, but going by what Dijkstra says in the video, the paper is an analysis, not a criticism in the derogatory sense -- in which case the current wording of the wikipedia article is biased.

Ross bencina (talk) 05:38, 5 January 2013 (UTC)[reply]

Original title was "A Case Against the Goto Statement". You're kind of right on this one, Ross. AFAIR, it was along the lines you're talking about - the whole 'criticism' was the result of a style war that erupted *after* the article, not the article itself IMO. Still, Dijjie said in that article: "The go to statement as it stands is just too primitive, it is too much an invitation to make a mess of one's program."

It IS a negative criticism, but Dij says himself that it's his *opinion*, based on what he seen - not an arbitrary, scientific fact. And I'm with him on this one.

Further reading: Considered harmful

Vaxquis (talk) 17:31, 11 April 2013 (UTC)[reply]

Criticism and decline out of date statement

[edit]

The section states that MISRA C Coding Standard prohibit the use of GOTO statements. This is not the case since MISRA2012:

  • MISRA C:2004 Rule 14.4 (required): The goto statement shall not be used
  • MISRA C:2012 Rule 15.1 (advisory): The goto statement should not be used

Simzer (talk) 15:33, 27 June 2013 (UTC)[reply]

Apple

[edit]

Is Apples Security failure missing in the article? :) 87.78.122.110 (talk) 20:00, 23 February 2014 (UTC)[reply]

"An empirical study of goto in C code"

[edit]

"An empirical study of goto in C code" (2015 paper) https://peerj.com/preprints/826v1.pdf and https://peerj.com/preprints/826v1/

"We conclude that developers limit themselves to using goto appropriately in most cases, thus suggesting that goto does not appear to be harmful in practice."

SbmeirowTalk21:51, 16 February 2015 (UTC)[reply]

Misc

[edit]

select case/etc are just computed goto - same use/results/speed. If they weren't the same programs would run really slow - half the assembly codes would be unsued. 2601:181:8000:D6D0:7855:5B43:1B2A:B0F4 (talk) 16:23, 5 May 2016 (UTC)[reply]

[edit]

Hello fellow Wikipedians,

I have just modified 2 external links on Goto. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

This message was posted before February 2018. After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{source check}} (last update: 5 June 2024).

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

Cheers.—InternetArchiveBot (Report bug) 13:19, 23 March 2017 (UTC)[reply]

[edit]

Hello fellow Wikipedians,

I have just modified one external link on Goto. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

This message was posted before February 2018. After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{source check}} (last update: 5 June 2024).

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

Cheers.—InternetArchiveBot (Report bug) 16:04, 21 October 2017 (UTC)[reply]

[edit]

The link to this doesn't work any longer: Sexton, Alex. "The Summer of Goto | Official Home of Goto.js". Retrieved April 28, 2012. Mikael4u (talk) 21:07, 17 April 2021 (UTC)[reply]

APL

[edit]

In APL there is no alternative to 'goto'-like branching, because it does not have instructions like if/else/switch. How about include a section about good branching techniques for such kind of programming languages? ~~ — Preceding unsigned comment added by 179.236.47.163 (talk) 23:07, 26 June 2018 (UTC)[reply]

Here is an interesting reference (see pages 10-11): ASWIEKE.PDF — Preceding unsigned comment added by 179.236.87.112 (talk) 19:52, 6 July 2018 (UTC)[reply]

Wheeler jump = gosub, not goto

[edit]

The Wheeler jump was the prototype for a subroutine jump -- i.e., save current instruction counter somewhere such that it can be used for subroutine return -- and not for a simple goto. The EDSAC already had 'goto' in the hardware: branch instructions E and G. What Wheeler devised was the coding sequences for 'save position and branch to specified location' and 'branch to saved position'. This is tantamount to inventing the closed subroutine.

The IEEE citation unfortunately described this as the 'precursor to goto' rather than 'precursor to gosub', an error that ought to be obvious since it also says 'to allow a program to pass control to a subroutine'. — Preceding unsigned comment added by 108.20.234.238 (talk) 21:37, 22 September 2018 (UTC)[reply]

I agree. That description of the Wheeler jump is fairly obviously a mistake in the IEEE citation. I have made a first attempt at correcting this section. --Stephen lamppost (talk) 16:48, 4 February 2019 (UTC)[reply]

Bohm and Jacopini didn't claim

[edit]

The Bohm and Jacopini paper "Flow Diagrams, Turing Machines and Languages with Only Two Formation Rules", didn't claim, much less prove, "that the goto statement is not necessary to write programs"; the scope of the paper was limited to programs that could be expressed as flow charts. It did not cover programs with subroutines, much less goto statements that unwound the stack. Shmuel (Seymour J.) Metz Username:Chatul (talk) 16:13, 15 August 2019 (UTC)[reply]

Perl Goto

[edit]

Article says "In Perl, there is a variant of the goto statement that is not a traditional GOTO statement at all. It takes a function name and transfers control by effectively substituting one function call for another (a tail call): the new function will not return to the GOTO, but instead to the place from which the original function was called."

This is absolutely a traditional GOTO; you can do exactly that with an ordinary jump instruction in machine code.

It's just not "traditional" in the narrow context of the history of a family of higher level languages that have always had a restricted form of GOTO.

Moreover, of course "the new function will not return to the GOTO"; GOTO isn't expected to return, unless it is GOSUB: a subroutine calling form of GOTO.

KazKylheku (talk) 19:38, 9 December 2020 (UTC)[reply]

Vague wording in article summary

[edit]

“Many languages support the goto statement, and many do not”

I feel that this statement is so vague as to be pointless at best and confusing at worst. This is because it’s phrased as a quantitative comparison.

I propose that we rephrase it to either include a good faith qualitative comparison of languages with support versus languages without support, or we use clearer wording such as, “there is now a considerable mix of languages support the goto statement in different methods.”

Any thoughts on this? ChiXiStigma (talk) 07:48, 5 August 2022 (UTC)[reply]