Re: Loop handle

2010-04-10 Thread John Rose
On Apr 10, 2010, at 3:01 PM, James Thorpe wrote: > If CPS is out - what about passing the loop condition and body into a > function that does the looping for you. http://blogs.sun.com/jrose/resource/jsr292/LoopHandle.zip -- John ___ mlvm-dev mailing

Re: Loop handle

2010-04-10 Thread James Thorpe
If CPS is out - what about passing the loop condition and body into a function that does the looping for you. in pseudo code defn loop_fn(cond, body) while (cond()) do body() end end this avoids the need for tail calls entirely - and I presume the whole lot

Re: Loop handle

2010-04-10 Thread Charles Oliver Nutter
With tail calling, it would certainly be possible. I think the tradeoff would be accepting that you wouldn't be able to completely compose a body of code in one shot; somewhere downstream you'd have to defer a decision like whether to exit the loop or not. That would probably mean slicing the nativ

Re: Loop handle?

2010-04-09 Thread Charles Oliver Nutter
On Fri, Apr 9, 2010 at 4:53 AM, Fredrik Öhrström wrote: > It might be fun, but I do not think that it is a good idea to implement > an interpreter in this way, > or more precisely, to implement any interpreter of bytecodes, using Java. I never said anything about a bytecode interpreter :) > For

Re: Loop handle?

2010-04-09 Thread Fredrik Öhrström
Charles Oliver Nutter wrote: > I ask because I still have a perverse desire to follow up on an idea > John Rose gave me to implement JRuby's interpreter entirely with > MethodHandles...with the obvious result being that by simply composing > a set of handles they'll already be compiled to native co

Re: Loop handle?

2010-04-09 Thread Charles Oliver Nutter
Yes, that thought crossed my mind. If tail calling were there, the only missing piece would be allowing a downstream handle (toward the target) to be able to be rebound to an upstream handle. Currently handles are a one-way street. On Fri, Apr 9, 2010 at 2:20 AM, Emmanuel Castro wrote: > Maybe th

Re: Loop handle?

2010-04-09 Thread Emmanuel Castro
Maybe there is no need to have a special handle for loops if there is an (hidden?) support for tail call in method handles ;-) I remind me a blog page from John Rose: http://blogs.sun.com/jrose/entry/tailcalls_meet_invokedynamic There is questioning about putting coroutine in Java7. Will Java7 inc