Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Go recursive function call tail-optimized?

Tags:

go

See: https://gobyexample.com/recursion

Some languages like Erlang have TCO. Is it the case with Go as well?

Specifically, I mean the main (popular for now) compiler available here: http://golang.org/doc/install

like image 971
mrkafk Avatar asked Dec 07 '25 02:12

mrkafk


1 Answers

Tail call optimization

There are no such plans for gc (6g, 5g, 8g).

I think it's very unlikely that the language would require it.

Russ

In the unlikely event that this changes, it will be documented in the Go Release History.

like image 179
peterSO Avatar answered Dec 08 '25 14:12

peterSO