Rev and tail-recusion
Dar Scott
dsc at swcp.com
Wed Apr 3 18:29:01 EST 2002
On Wednesday, April 3, 2002, at 03:33 PM, James Witte wrote:
> Does the "demo" version of Rev have any limits on depth of recusion?
> Does Revolution handle tail-recusion correctly (as a jump without
> building
> a call frame, like Scheme and C# and unlike Java)?
In the documentation...
Development Guide --> The System Environment --> Ref --> Mem & Limits
... this info is provided:
"Unlimited" means bound by available memory or 4G whichever is
smaller.
Maximum Level of Recursion: Unlimited
The documentation on scriptLimits() function doesn't indicate any
other limitation on recursion.
I would guess that Revolution probably does not implement tail
recursion optimization, but it is hard to tell from the above
information. Would you like to do the crash test?
Since the documentation on recursion does not place any other
guarantees on recursion depth, then both optimization and lack of
optimization are "correct". The implementer is free to implement
it.
Being new to Revolution, I can only repeat the docs.
Forever loops in many apps are probably "send ... to me in ...",
anyway. There is no depth limit here if care is taken. State
would exist in, say, global variables and elsewhere. There is no
need to pass state as parameters, and the whole idea wouldn't fit
into Revolution style, of course.
Dar Scott
More information about the use-livecode
mailing list