<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.sarg.dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=72.136.122.248</id>
	<title>Vero - Wikipedia - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.sarg.dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=72.136.122.248"/>
	<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php/Special:Contributions/72.136.122.248"/>
	<updated>2026-07-04T16:10:02Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://wiki.sarg.dev/index.php?title=COMEFROM&amp;diff=587087</id>
		<title>COMEFROM</title>
		<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php?title=COMEFROM&amp;diff=587087"/>
		<updated>2025-09-14T03:57:39Z</updated>

		<summary type="html">&lt;p&gt;72.136.122.248: /* Python */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Short description |Programming language control flow statement; opposite of goto}}&lt;br /&gt;
In [[computer programming]], &#039;&#039;&#039;COMEFROM&#039;&#039;&#039; is a [[control flow]] [[statement (programming)|statement]] that causes [[control flow]] to jump to the statement after it when control reaches the point specified by the COMEFROM argument. The statement is intended to be the opposite of [[goto]] and is considered to be more a joke than serious [[computer science]]. Often the specified jump point is identified as a [[label (programming language)|label]]. For example, &amp;lt;code&amp;gt;COMEFROM x&amp;lt;/code&amp;gt; specifies that when control reaches the label &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt;, then control continues at the statement after the COMEFROM.&lt;br /&gt;
&lt;br /&gt;
A major difference with goto is that goto depends on the local structure of the code, while COMEFROM depends on the global structure. A goto statement transfers control when control reaches the statement, but COMEFROM requires the processor (i.e. interpreter) to scan for COMEFROM statements so that when control reaches any of the specified points, the processor can make the jump. The resulting logic tends to be difficult to understand since there is no indication near a jump point that control will in fact jump. One must study the entire program to see if any COMEFROM statements reference that point.&lt;br /&gt;
&lt;br /&gt;
The semantics of a COMEFROM statement varies by [[programming language]]. In some languages, the jump occurs before the statement at the specified point is executed and in others the jump occurs after. Depending on the language, multiple COMEFROM statements that reference the same point may be invalid, non-deterministic, executed in some order, or induce [[parallel computing |parallel]] or otherwise [[concurrent computing |concurrent]] processing as seen in [[INTERCAL |Threaded Intercal]].{{cn|date=September 2019}}&lt;br /&gt;
&lt;br /&gt;
COMEFROM was initially seen in lists of joke [[assembly language]] instructions (as &#039;CMFRM&#039;). It was elaborated upon in a [[Datamation]] article by R. Lawrence Clark in 1973,&amp;lt;ref&amp;gt;{{Citation |url= http://www.fortran.com/fortran/come_from.html |last= Clarke |first= Lawrence |author-link= R. Lawrence Clark |title= We don&#039;t know where to GOTO if we don&#039;t know where we&#039;ve COME FROM. This linguistic innovation lives up to all expectations. |journal= [[Datamation]] |type= article |access-date= 2004-09-24 |archive-url= https://web.archive.org/web/20180716171336/http://www.fortran.com/fortran/come_from.html |archive-date= 2018-07-16 |url-status= dead }}.&amp;lt;/ref&amp;gt; written in response to [[Edsger Dijkstra]]&#039;s letter &#039;&#039;[[Go To Statement Considered Harmful]]&#039;&#039;. COMEFROM was eventually implemented in the C-INTERCAL variant of the [[esoteric programming language]] [[INTERCAL]] along with the even more obscure &#039;computed COMEFROM&#039;. There were also [[Fortran]] proposals&amp;lt;ref&amp;gt;{{Cite journal |url= http://www.modell.com/Magery/SPharmful.html |last= Modell |first= Howard |last2= Slater |first2= William |title= Structured programming considered harmful |date= April 1978 |journal= ACM SIGPLAN Notices |volume=13 |issue= 4 |pages= 76–79 |doi= 10.1145/953411.953418 |access-date= 18 July 2014|doi-access= free }}&amp;lt;/ref&amp;gt; for &#039;assigned COME FROM&#039; and a &#039;DONT&#039; statement (to complement the existing &#039;DO&#039; loop).&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===BASIC===&lt;br /&gt;
The following code is for a hypothetical [[BASIC]] dialect with &amp;lt;code&amp;gt;COMEFROM&amp;lt;/code&amp;gt;. It asks for a name, greets with the name, and repeats. Line 40 is the jump point specified by the COMEFROM, so when control reaches 40 it jumps to 10.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;qbasic&amp;quot;&amp;gt;&lt;br /&gt;
10 COMEFROM 40&lt;br /&gt;
20 INPUT &amp;quot;WHAT IS YOUR NAME? &amp;quot;; A$&lt;br /&gt;
30 PRINT &amp;quot;HELLO, &amp;quot;; A$&lt;br /&gt;
40 REM&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Python===&lt;br /&gt;
{{Anchor|PythonGoto}}On 1 April 2004, Richie Hindle published an implementation of COMEFROM for [[Python (programming language)|Python]] that uses debugger hooks. Despite being released on [[April Fools&#039; Day]] and not being intended for serious use, the syntax is valid and the implementation fully works.&amp;lt;ref name=&amp;quot;:0&amp;quot;&amp;gt;{{Citation|last=Hindle|first=Richie|title=goto for Python|date=1 April 2004|url=http://entrian.com/goto/|publisher=Entrian}}.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The code below, which is actually runnable, uses this Python implementation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from goto import comefrom, label&lt;br /&gt;
comefrom .repeat&lt;br /&gt;
&lt;br /&gt;
name: str = raw_input(&amp;quot;What is your name? &amp;quot;)&lt;br /&gt;
if name:&lt;br /&gt;
    print(f&amp;quot;Hello, {name}&amp;quot;)&lt;br /&gt;
    label .repeat&lt;br /&gt;
print(&amp;quot;Goodbye!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ruby===&lt;br /&gt;
This is an implementation in [[Ruby (programming language)|Ruby]] of the Intercal COME FROM statement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
$come_from_labels = {}&lt;br /&gt;
&lt;br /&gt;
def label(l)&lt;br /&gt;
  if $come_from_labels[l]&lt;br /&gt;
    $come_from_labels[l].call&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def come_from(l)&lt;br /&gt;
  callcc do |block|&lt;br /&gt;
    $come_from_labels[l] = block&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===OS/360 Fortran G===&lt;br /&gt;
In the OS/360 Fortran G compiler debug packet, the {{code |AT}} statement acts like COMEFROM in that it hands the control flow over to the debug block {{endash}} similar to a [[breakpoint]].&amp;lt;ref&amp;gt;IBM System/360 and System/370 Fortran IV Language, GC28-6515-10, May 1974&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the following code, the values of {{code |SOLON}}, {{code |GFAR}}, and {{code |EWELL}} are examined as they were at the completion of statement 10. The {{code |AT}} statement indicates statement 11.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;fortranfixed&amp;quot;&amp;gt;&lt;br /&gt;
      INTEGER SOLON, GFAR, EWELL&lt;br /&gt;
         .&lt;br /&gt;
         .&lt;br /&gt;
         .&lt;br /&gt;
10    SOLON = GFAR * SQRT(FLOAT(EWELL))&lt;br /&gt;
11    IF (SOLON) 40, 50, 60&lt;br /&gt;
         .&lt;br /&gt;
         .&lt;br /&gt;
         .&lt;br /&gt;
      DEBUG UNIT(3)&lt;br /&gt;
      AT 11&lt;br /&gt;
      DISPLAY GFAR, SOLON, EWELL&lt;br /&gt;
      END&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the following code, the values of {{code |STOCK}} are displayed when statement 35 is encountered.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;fortranfixed&amp;quot;&amp;gt;&lt;br /&gt;
      DIMENSION STOCK(1000),OUT(1000)&lt;br /&gt;
         .&lt;br /&gt;
         .&lt;br /&gt;
         .&lt;br /&gt;
      DO 30 I=1, 1000&lt;br /&gt;
25    STOCK(I)=STOCK(I) - OUT(I)&lt;br /&gt;
30    CONTINUE&lt;br /&gt;
35    A = B + C&lt;br /&gt;
         .&lt;br /&gt;
         .&lt;br /&gt;
         .&lt;br /&gt;
      DEBUG UNIT(3)&lt;br /&gt;
      AT 35&lt;br /&gt;
      DISPLAY STOCK&lt;br /&gt;
      END&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the following code, tracing begins at statement 10, at statement 20, tracing stops while the loop is executed, and resumes after the loop.  Tracing stops just before statement 30 is executed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;fortranfixed&amp;quot;&amp;gt;&lt;br /&gt;
10    A = 1.5&lt;br /&gt;
12    L = 1&lt;br /&gt;
15    B = A + 1.5&lt;br /&gt;
20    DO 22 I = 1,5&lt;br /&gt;
         .&lt;br /&gt;
         .&lt;br /&gt;
         .&lt;br /&gt;
22    CONTINUE&lt;br /&gt;
25    C = B + 3.16&lt;br /&gt;
30    D = C/2&lt;br /&gt;
      STOP&lt;br /&gt;
         .&lt;br /&gt;
         .&lt;br /&gt;
         .&lt;br /&gt;
      DEBUG UNIT(3), TRACE&lt;br /&gt;
C     DEBUG PACKET NUMBER 1&lt;br /&gt;
      AT 10&lt;br /&gt;
      TRACE ON&lt;br /&gt;
C     DEBUG PACKET NUMBER 2&lt;br /&gt;
      AT 20&lt;br /&gt;
      TRACE OFF&lt;br /&gt;
      DO 35 I = 1,3&lt;br /&gt;
         .&lt;br /&gt;
         .&lt;br /&gt;
         .&lt;br /&gt;
35    CONTINUE&lt;br /&gt;
      TRACE ON&lt;br /&gt;
C     DEBUG PACKET NUMBER 3&lt;br /&gt;
      AT 30&lt;br /&gt;
      TRACE OFF&lt;br /&gt;
      END&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* {{Annotated link |Action at a distance (computer science)|Action at a distance}}&lt;br /&gt;
* {{Annotated link |Continuation}}&lt;br /&gt;
* {{Annotated link |Database trigger}}&lt;br /&gt;
* {{Annotated link |Event-driven programming}}&lt;br /&gt;
* [[F. X. Reid]] {{endash}} an expert on the semantics of COMEFROM&amp;lt;ref&amp;gt;F. X. Reid, On the Formal Semantics of the COMEFROM Statement. [https://www.bcs.org/media/5044/issue-2006-1-march-2006.pdf &#039;&#039;FACS FACTS&#039;&#039;, Issue 2006-1], pages 18–20, March 2006.&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Goto/From signal routing blocks in [[MATLAB]] Simulink&lt;br /&gt;
* {{Annotated link |Pointcut}}&lt;br /&gt;
* {{Annotated link |Observer pattern}}&lt;br /&gt;
* {{Annotated link |Webhook}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{reflist}}&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[http://c2.com/cgi/wiki?ComeFrom COMEFROM Information Page]&lt;br /&gt;
*[https://web.archive.org/web/20180716171336/http://www.fortran.com/fortran/come_from.html Datamation Article]&lt;br /&gt;
*[https://web.archive.org/web/20121022080527/http://homepage.ntlworld.com/brook.street/funny/pdp11.htm Joke Assembler Instruction List Including CMFRM]&lt;br /&gt;
*[https://metacpan.org/module/Acme::ComeFrom comefrom support for Perl]&lt;br /&gt;
&lt;br /&gt;
{{DEFAULTSORT:Comefrom}}&lt;br /&gt;
[[Category:Computer humour]]&lt;br /&gt;
[[Category:Control flow]]&lt;br /&gt;
[[Category:Articles with example Python (programming language) code]]&lt;/div&gt;</summary>
		<author><name>72.136.122.248</name></author>
	</entry>
</feed>