# Disabling tail-call optimization

**URL:** <https://discourse.ats-lang.org/t/disabling-tail-call-optimization/214>\
**Category:** Google Group\
**Created:** [August 5, 2015, 1:28pm UTC](https://discourse.ats-lang.org/t/disabling-tail-call-optimization/214 "2015-08-05T13:28:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [August 5, 2015, 1:28pm UTC](https://discourse.ats-lang.org/t/disabling-tail-call-optimization/214/1 "2015-08-05T13:28:30Z")

</div>

In ATS/Postiats, a recursive tail-call is compiled into a local jump by  
default.  
One can disable tail-call optimization with the flag ‘–tlcalopt-disable’:

patscc --tlcalopt-disable …  
patsopt --tlcalopt-disable …

Erlang does its own tail-call optimization. It is a pure functional  
language and  
does not support local jumps. So while compiling ATS to Erlang (vial  
atscc2erl),  
please make sure that you use patscc/patsopt with the flag  
’–tlcalopt-disable’.

–Hongwei

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [July 1, 2016, 5:58pm UTC](https://discourse.ats-lang.org/t/disabling-tail-call-optimization/214/2 "2016-07-01T17:58:56Z")

</div>

ATS can now be compiled into Scheme via atscc2scm.

It is mandatory to disable tail-call optimization if the generated  
C code is to be fed to atscc2scm.On Wednesday, August 5, 2015 at 9:28:30 AM UTC-4, gmhwxi wrote:

> In ATS/Postiats, a recursive tail-call is compiled into a local jump by  
> default.  
> One can disable tail-call optimization with the flag ‘–tlcalopt-disable’:
> 
> patscc --tlcalopt-disable …  
> patsopt --tlcalopt-disable …
> 
> Erlang does its own tail-call optimization. It is a pure functional  
> language and  
> does not support local jumps. So while compiling ATS to Erlang (vial  
> atscc2erl),  
> please make sure that you use patscc/patsopt with the flag  
> ‘–tlcalopt-disable’.
> 
> –Hongwei
