On Friday, 24 October 2014 at 14:50:53 UTC, Ola Fosheim Grøstad
wrote:
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.
It is worth pointing out that one advantage of taking this
uniform view is that you can more easily define a system to
persist/migrate a transitive closure of objects/fibers and
transfer them to other servers.
However, it does not have to be stackless in terms of
implementation. A stack is then an optimization, the compiled
code can put things on the stack until it at runtime hits a yield
(at which point you have to pick it up).