Isn’t the same true of forgetting #[stacksafe]?
This reminds me of certain Haskell patterns where you selectively make some operations strict instead of lazy for similar reasons. I’m glad this library exists, but I’m sad the Rust compiler itself doesn’t have better support for recursion.
> This approach works for simple cases but becomes extremely complex or impossible when any of these conditions apply:
> 1. The algorithm transforms data structures rather than just evaluating them (e.g., optimizing an AST)
> 2. Multiple recursive calls need to be coordinated (e.g., tree balancing algorithms)
> 3. The algorithm doesn’t fit the tail-recursion pattern
I would disagree with "impossible" (pretty sure it's never actually impossible, but some type systems and language features may work together to make it so, I suppose), but definitely agree with "extremely complex".
lionkor•2h ago
[1] https://docs.rs/tailcall/latest/tailcall/
ameliaquining•2h ago