Re: Forcing closures to come on the stack

2011-08-08 Thread Jonathan M Davis
> > You could use the 'scope' keyword, no? > > From what I've heard it's being deprecated/removed -- although I'd be > glad to hear otherwise. scope on function parameters is sticking around as are scoped statements. What's going around is scoped local variables which put a class on the stack.

Re: Forcing closures to come on the stack

2011-08-08 Thread %u
> You could use the 'scope' keyword, no? >From what I've heard it's being deprecated/removed -- although I'd be glad to hear otherwise.

Re: Forcing closures to come on the stack

2011-08-08 Thread Simen Kjaeraas
On Mon, 08 Aug 2011 04:51:19 +0200, Mehrdad wrote: I just made something I thought I'd share. It's great for those times when the compiler decides to randomly put a closure on the heap. The usage is pretty simple: int x = 5; auto adder5 = mixin(closure!x(q{(int a) { return a + x

Forcing closures to come on the stack

2011-08-07 Thread Mehrdad
I just made something I thought I'd share. It's great for those times when the compiler decides to randomly put a closure on the heap. The usage is pretty simple: int x = 5; auto adder5 = mixin(closure!x(q{(int a) { return a + x; }})); assert(adder5(10) == 15); It returns a calla