title: Is Erlang's recursive functions not just a goto?
body: <p>Just to get it straight in my head. Consider this example bit of Erlang code:</p>
  
  <pre><code> test() -&gt;
        receive
            {From, whatever} -&gt;
                  %% do something
                 test();
            {From, somethingelse} -&gt;
                 %% do something else
                 test();
   end.
  </code></pre>
  
  <p>Isn't the test() call, just a goto?</p>
  
  <p>I ask this because in C we learned, if you do a function call, the return location is always put on the stack. I can't imagine this must be the case in Erlang here since this would result in a stackoverflow.</p>
  
  <p>We had 2 different ways of calling functions:
  goto and gosub.
  goto just steered the program flow somewhere else, and gosub remembered where you came from so you could return.</p>
  
  <p>Given this way of thinking, I can look at Erlang's recursion easier, since if I just read: test() as a goto, then there is no problem at all.</p>
  
  <p>hence my question: isn't :Erlang just using a goto instead of remembering the return address on a stack?</p>
  
  <p>EDIT:</p>
  
  <p>Just to clarify my point:</p>
  
  <p>I know goto's can be used in some languages to jump all over the place. But just supose instead of doing someFunction()  you can also do:  goto someFunction()
  in the first example the flow returns, in the second example the flow just continues in someFunction and never returns.</p>
  
  <p>So we limit the normal GOTO behaviour by just being able to jump to method starting points.</p>
  
  <p>If you see it like this, than the Erlang recursive function call looks like a goto.</p>
  
  <p>(a goto in my opinion is a function call without the ability to return where you came from). Which is exactly what is happening in the Erlang example. </p>