tail recursion, continuations, and other tricks --
[1/1] from: maarten::vrijheid::net at: 17-Oct-2003 17:42
Hi List, See below, reposted with permission. If we only can get RT to include Ladislav's or my tail-func... ---------------------------- Hi Maarten, This used to be in REBOL (tail recursion, continuations, and other tricks -- using some of the most advanced optimization concepts invented). Problem was, it caused REBOL to use many times more memory, and it was many times slower. We had to take it all out. Continuations are a cool concept in theory. Since I first learned about them in 1984, they have seemed like a useful idea. Problem is, not every useful idea is practical. Continuations often reference a huge context (hence is not allowed to be GC'd), even if your code exited the context long ago. If you think REBOL gobbles memory for contexts now, it was really bad in the continuation days. Tail recursion is another issue. I've implemented it before in other languages (e.g. Amiga Logo) and found that it was a bit tricky. It's one of those things I'd like to put back into REBOL, but there are other, more severe restrictions in recursion that have higher priority. For example, there's a GC protection stack that I think overly limits recursion in the current interpreter. We've actually removed it in an experimental version, but its untested and we worry that it may make REBOL unstable so we've not released it (testing takes so much time compared to coding!) Let me know how it goes. Best regards, -Carl PS: Feel free to repost this message if you want/need to.