[erlang-questions] Tail call optimization

Salikhov Dinislam Dinislam.Salikhov@REDACTED
Mon Oct 17 10:58:59 CEST 2016


Hello.

Erlang guarantees tail recursion optimization and states it in the 
documentation:
http://erlang.org/doc/reference_manual/functions.html#id78464

Does erlang guarantee that tail call optimization is done in a generic 
case, without recursion?
Say, we have a function calling a function from another module as its 
final statement:
     alpha() ->
         xxx:beta().
Is it guaranteed that xxx:beta() will use the stack of alpha() 
regardless whether recursion is involved.
I mean whether the language guarantees it rather than virtual machine 
may provide such optimization.

Thanks in advance,
Salikhov Dinislam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20161017/f88beebf/attachment.htm>


More information about the erlang-questions mailing list