Hacker News new | past | comments | ask | show | jobs | submit login

Recursive lifetimes. The idea of the gp.



Oh gosh, so I had seen your comment on mobile, and couldn't tell who you were replying to. I thought you were asking about "OCaml and C had a baby."

I have no idea, maybe your original parent will elaborate :)


I don’t understand the confusion. It’s all right there, on page 404 of the rust spec:

> Parameters with a recursive lifetime can only be used in a tail-call position within a function. If a function with only recursive params compiles successfully, it is guaranteed not to grow the stack.

For the self-recursive case, people are likely better off just writing the imperative version. But using these with mutual recursive calls lets you build safely build state machines that compile down to the same performant code a classic goto-based implementation would in C.


Sounds reasonable.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: