Stackless resumable functions

via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 24 07:50:51 PDT 2014


On Friday, 24 October 2014 at 10:33:40 UTC, Martin Nowak wrote:
> What I like most about the proposal is that you can adapt await 
> by specializing template functions, similar to how range based 
> foreach works.
> It also isn't tied to a particular scheduling mechanism and of 
> course consumes much less memory than stack based suspension.

This is how all truly object oriented languages with concurrency 
works. Block activation records are conceptually on the heap and 
there is no difference between an object and a function: 
Simula67, Beta, Self…

It is slower than using a stack though, but if done as in Beta 
you get a back pointer to the caller (who instantiate the 
function/object) which can be handy for modelling.


More information about the Digitalmars-d mailing list