Stack overflow
[1/2] from: moeller_thorsten::gmx::de at: 28-Jun-2001 9:32
Hi,
i have some problems with an app i put together. There is a wait loop which
is testing for an time argument to come true and send/receive a mail. This
wait-loop always ends up in an stack overflow error.
receive: [ 15:45 (code ......)]
wait-loop: does [
dispatch [1 [
if equal? now/time first receive [ do next receive ]
]
wait-loop
]]
Any suggestions?
Perhaps there is anybody who can help me out with a little code to do this.
Thorsten
[2/2] from: joel:neely:fedex at: 28-Jun-2001 7:05
Hi, Thorsten,
Thorsten Moeller wrote:
> Hi,
> i have some problems with an app i put together. There is a
<<quoted lines omitted: 9>>
> ] ]
> Any suggestions?
As I'm sure you know, DOES simply creates a function with
neither parameters nor locals. Therefore, your WAIT-LOOP
is recursive.
There's no exit/return, and REBOL doesn't do tail-recursion
elimination, so every "cycle" consumes more stack.
Try wrapping DISPATCH in a loop of some sort and eliminating
the recursion.
HTH!
-jn-
------------------------------------------------------------
Programming languages: compact, powerful, simple ...
Pick any two!
joel'dot'neely'at'fedex'dot'com
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted