Re:Learning Go by porting a medium-sized web back end from P...
by calcifer on Thursday November 09, 2017 @05:40PM
(#15666385)
> Is it internally rewriting to a loop
Yes. You add a `tailrec` modifier to your function. The compiler then checks if the last op in the function is a call to itself. If it is, it gets replaced with a loop. If not, you get a warning that `tailrec` is ignored.
Yes. You add a `tailrec` modifier to your function. The compiler then checks if the last op in the function is a call to itself. If it is, it gets replaced with a loop. If not, you get a warning that `tailrec` is ignored.