[m-users.] Enable LCMC tail recursion optimization by default?

Dirk Ziegemeyer dirk at ziegemeyer.de
Tue Apr 19 17:19:16 AEST 2016

I have learned so far that tail recursion is important to avoid stack overflows and that code might look tail recursive but isn’t. Common predicates like list.map and list.append are not tail recursive in Mercury by default but can be transformed to be tail-recursive with the LCMC-option.


Enabling the option optimize_constructor_last_call only affects my own code but not the list library which was compiled during mercury installation without this option.

Does it make sense to enable LCMC in future versions of the Mercury compiler by default in order to avoid duplicating the code for e.g. list.append in the own application?

Best regards,

Dirk Ziegemeyer

More information about the users mailing list