Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Stack overflow

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 > 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? >
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