Re: Simple trampoline code

2009-06-15 Thread bearophile
Ellery Newcomer: > How DO you define the signature of a function that returns itself? You may need a language with a type system more powerful than D type system (like Scala?). > And FYI, dmd handles your particular example recursively just fine. But > you probably know that. I don't understa

Re: Simple trampoline code

2009-06-11 Thread BCS
Hello Ellery, BCS wrote: Hello Ellery, bearophile wrote: I'm trying to convert to D2 the following (quite simplified up) Python code, that implements a trampoline to run tail-call functions with no stack overflow: [...] How DO you define the signature of a function that returns itself?

Re: Simple trampoline code

2009-06-11 Thread Ellery Newcomer
BCS wrote: > Hello Ellery, > >> bearophile wrote: >> >>> I'm trying to convert to D2 the following (quite simplified up) >>> Python code, that implements a trampoline to run tail-call functions >>> with no stack overflow: > [...] >> >> How DO you define the signature of a function that returns its

Re: Simple trampoline code

2009-06-11 Thread BCS
Hello Ellery, bearophile wrote: I'm trying to convert to D2 the following (quite simplified up) Python code, that implements a trampoline to run tail-call functions with no stack overflow: [...] How DO you define the signature of a function that returns itself? Last I checked, you can't.

Re: Simple trampoline code

2009-06-11 Thread Ellery Newcomer
bearophile wrote: > I'm trying to convert to D2 the following (quite simplified up) Python code, > that implements a trampoline to run tail-call functions with no stack > overflow: > > # Python code > # *args means almost all the arguments > def trampoline(fun, *args): > thunk = lambda : fun

Simple trampoline code

2009-06-11 Thread bearophile
I'm trying to convert to D2 the following (quite simplified up) Python code, that implements a trampoline to run tail-call functions with no stack overflow: # Python code # *args means almost all the arguments def trampoline(fun, *args): thunk = lambda : fun(*args) while True: (th