Continuations and recursion
|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Continuations and recursionHi, I am having problems with recursion using rife 1.6 on jdkl 1.5. I am implementing a simple Tower of Hanoi and have a recursive call after the pause() function. This causes the function to call after the pause() which is stack overflowing. Should I be using one of the Call/answer or other styles if so anyone have details on how these are used? Cheers --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "rife-users" group. To post to this group, send email to rife-users@... To unsubscribe from this group, send email to rife-users-unsubscribe@... For more options, visit this group at http://groups.google.com/group/rife-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
|
|
|
|
|
|
Re: Continuations and recursionHi again Frederick, I committed a fix to trunk that makes this work. So in the next RIFE snapshot recursion in continuations should just do what you expect ... yay! ;-) HTH, Geert On Thu, Apr 3, 2008 at 6:32 PM, Geert Bevin <gbevin@...> wrote: > Hi Frederick, > > I stepped through your code and found why this is happening, it is > also 'normal'. > > When you resume the continuation after the first 'pause', you call the > entrance method 'execute' again. This method is then executed with the > exact same context as when the continuation was resumed. So it jumps > over the code again as if it resumed again, calling 'execute' again > ... and so on, until the stack is depleted. > > Hope this helps, > > Geert > > > > On Tue, Apr 1, 2008 at 10:56 AM, Frederick Isaac <freddyisaac@...> wrote: > > Hi Geert, > > > > Glad to see that you have some bandwidth to look at my albeit obscure > > problem. I am sending you the code. I am not sure that it is neither correct > > nor optimal and would really appreciate your input. The mainTest uses a > > SimpleHanoi as a correctness check and then uses TestPauseParm for which > > most of the supporting classes are concerned with enabling the continuation > > to use parameters. > > > > This comes from a simple unix environment (currently solaris 10 running JDK > > 1.5). > > > > Just type build then use run to see how the stack is exploded on the post > > continuation recursion. > > > > Hope this help > > > > Cheers > > > > > > > > > > > > > > > > On 3/29/08, Geert Bevin <gbevin@...> wrote: > > > Yes, please send me the example that fails for you. The only example > > > that I could find in the email archives is one that has a problem with > > > inner classes not being static and hence not having a default > > > constructor that can be called from outside the enclosing class. > > > > > > > > > On Tue, Mar 4, 2008 at 4:40 AM, Frederick Isaac <freddyisaac@...> > > wrote: > > > > Just to follow on with more information > > > > > > > > The first call correctly recurses using execute in place of hanoi, and > > the > > > > continuation stops the execution. > > > > The second execute causes entry in to the routine, but upon reaching the > > > > move (pause() ) we exit from, but when we return to the continuation we > > do > > > > not start from the second execute point and just enter again. > > > > > > > > Have you been able to verify if this works or not - do you still need me > > to > > > > send my example? > > > > > > > > Thanks for looking into this. > > > > > > > > Cheers > > > > > > > > > > > > > > > > > > > > > > > > > > > > On 3/1/08, Frederick Isaac <freddyisaac@...> wrote: > > > > > > > > > > Thought I did, > > > > > > > > > > I can resend it though if you wish? > > > > > > > > > > Cheers > > > > > > > > > > It was a pretty simple tower of hanoi recursive solution > > > > > > > > > > like this > > > > > > > > > > void move(int disk, String f, String t) > > > > > { > > > > > System.out.println("moving disk " + disk + ": " + f + > > " -> > > > > " + t); > > > > > } > > > > > void hanoi(int disks, String f, String t, String r) > > > > > { > > > > > if(disks > 0) > > > > > { > > > > > hanoi(disks - 1, f, r, t); > > > > > move(disks - 1, f, t); > > > > > hanoi(disks - 1, r, t, f); > > > > > } > > > > > } > > > > > > > > > > > > > > > but I wanted to remove the move function and replace it with a pause > > which > > > > should continue the recursion when reentered. > > > > > > > > > > The code mostly modifes the existing classes to define methods that > > have > > > > parameters > > > > > > > > > > Cheers > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On 3/1/08, Geert Bevin <gbevin@...> wrote: > > > > > > Looking at it now, did you send me some sample code before that > > shows > > > > > > this behavior? > > > > > > > > > > > > On Sat, Mar 1, 2008 at 8:33 AM, Frederick Isaac > > <freddyisaac@...> > > > > wrote: > > > > > > > Hi again, > > > > > > > > > > > > > > any thoughts on the recursion question? > > > > > > > > > > > > > > Cheers > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On 2/26/08, Frederick Isaac <freddyisaac@...> wrote: > > > > > > > > > > > > > > > > cool, > > > > > > > > > > > > > > > > thanks very much > > > > > > > > > > > > > > > > Cheers > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On 2/25/08, Geert Bevin <gbevin@...> wrote: > > > > > > > > > Actually, I was planning on looking at it today or tomorrow, > > > > depending > > > > > > > > > on how I advance with my work :-) > > > > > > > > > > > > > > > > > > On Mon, Feb 25, 2008 at 11:54 AM, Frederick Isaac > > > > > > > <freddyisaac@...> wrote: > > > > > > > > > > Hi again Geert, > > > > > > > > > > > > > > > > > > > > I was wondering if you were able to find some time yet to > > > > discuss the > > > > > > > > > > recursion problem I was experiencing with Rife. > > > > > > > > > > > > > > > > > > > > Cheers > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On 1/22/08, Frederick Isaac <freddyisaac@...> wrote: > > > > > > > > > > > > > > > > > > > > > > I am very sorry to hear about your father. > > > > > > > > > > > I entirely understand that this really wouldn't be of much > > > > interest > > > > > > > to you > > > > > > > > > > right now. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On 1/21/08, Geert Bevin <gbevin@...> wrote: > > > > > > > > > > > > Hi, > > > > > > > > > > > > > > > > > > > > > > > > I'm terribly sorry that I haven't replied to your latest > > > > emails > > > > > > > yet. > > > > > > > > > > > > My father passes away last week and I have to take care > > of > > > > > > > everything > > > > > > > > > > > > related to that. Since I can't answer off the bat on > > your > > > > question > > > > > > > and > > > > > > > > > > > > have to experiment myself, I sadly don't have time for > > that > > > > atm. > > > > > > > I'll > > > > > > > > > > > > look into it as soon as I can. > > > > > > > > > > > > > > > > > > > > > > > > Tare care, > > > > > > > > > > > > > > > > > > > > > > > > Geert > > > > > > > > > > > > > > > > > > > > > > > > On 1/22/08, bonehead <freddyisaac@...> wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > Hi, > > > > > > > > > > > > > > > > > > > > > > > > > > I am having problems with recursion using rife 1.6 on > > jdkl > > > > 1.5. > > > > > > > I am > > > > > > > > > > > > > implementing a simple Tower of Hanoi and have a > > recursive > > > > call > > > > > > > after > > > > > > > > > > > > > the pause() function. This causes the function to call > > > > after the > > > > > > > > > > > > > pause() which is stack overflowing. > > > > > > > > > > > > > > > > > > > > > > > > > > Should I be using one of the Call/answer or other > > styles > > > > if so > > > > > > > anyone > > > > > > > > > > > > > have details on how these are used? > > > > > > > > > > > > > > > > > > > > > > > > > > Cheers > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > Geert Bevin > > > > > > > > > > > > Terracotta - http://www.terracotta.org > > > > > > > > > > > > Uwyn "Use what you need" - http://uwyn.com > > > > > > > > > > > > RIFE Java application framework - http://rifers.org > > > > > > > > > > > > Music and words - http://gbevin.com > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > Geert Bevin > > > > > > > > > Terracotta - http://www.terracotta.org > > > > > > > > > Uwyn "Use what you need" - http://uwyn.com > > > > > > > > > RIFE Java application framework - http://rifers.org > > > > > > > > > Music and words - http://gbevin.com > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > Geert Bevin > > > > > > Terracotta - http://www.terracotta.org > > > > > > Uwyn "Use what you need" - http://uwyn.com > > > > > > RIFE Java application framework - http://rifers.org > > > > > > Music and words - http://gbevin.com > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > Geert Bevin > > > Terracotta - http://www.terracotta.org > > > Uwyn "Use what you need" - http://uwyn.com > > > RIFE Java application framework - http://rifers.org > > > Music and words - http://gbevin.com > > > > > > > > > > > -- > > > Geert Bevin > Terracotta - http://www.terracotta.org > Uwyn "Use what you need" - http://uwyn.com > RIFE Java application framework - http://rifers.org > Music and words - http://gbevin.com > -- Geert Bevin Terracotta - http://www.terracotta.org Uwyn "Use what you need" - http://uwyn.com RIFE Java application framework - http://rifers.org Music and words - http://gbevin.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "rife-users" group. To post to this group, send email to rife-users@... To unsubscribe from this group, send email to rife-users-unsubscribe@... For more options, visit this group at http://groups.google.com/group/rife-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
|
