Scala has the @tailrec annotation which will raise a warning if the function can’t be TCO’d