The future of foreach

BCS ao at pathlink.com
Sun Dec 23 14:45:48 PST 2007


Reply to Janice,
>
> Thoughts?
> 

If you can be totally sure of the amount of stack space that will be used 
you can do 2+ opApplies (*) at the same time.

1) Run the first opApply
2) Push a bunch of stuff on the stack (to make some room)
3) call the other opApply
4) call the real action delegate
5) return from the action delegate called just after step 1
6) when you get back to that delegate then return from the action delegate 
called after step 3
7) loop at step 4

To make it work you need to have low level access the the stack and frame 
pointers.

I'm not suggesting it be done (it's a bit to low level) but it just struck 
me that it could be done.

*) what is the plural of "opApply"; "opApplies" or "opApplys"?





More information about the Digitalmars-d mailing list