nadako / haxe-coroutines

41 stars 5 forks source link

pecan vs nadakoroutines #15

Closed nadako closed 3 years ago

nadako commented 3 years ago

since pecan is the currently the most promising macro implementation for coroutines and its idea is pretty close to what we have in mind in this proposal, we can use it (or its fork) as a proving ground before moving the implementation into the compiler.

here I outline the current key differences between pecan and the proposed design (calling it nadakoroutines for brevity):

starting

pecan

nadakoroutines

suspending

pecan

nadakoroutines

resuming

pecan

nadakoroutines

passing values

pecan

nadakoroutines

extra features

pecan

francescoagati commented 3 years ago

hi @nadako, another important feaure for coroutine shoud be serialization in this mode a coroutine can be saved and restored

nadako commented 3 years ago

I have to think how coroutines play with serialization. I don't think you can serialize coroutines in general, since there are function pointers binding them together and such and I'm not even sure that's something that should be supported by the coroutine mechanism itself rather than a framework on top, but we should look into enabling such frameworks to do that, yeah :)

francescoagati commented 3 years ago

some language and framework like racket(scheme) and seaside/smalltalk support continuation serialization

https://docs.racket-lang.org/web-server/stateless.html#%28part._.Serializable_.Continuations%29 https://defn.io/2019/04/07/web-continuations/

francescoagati commented 3 years ago

in general the serialization isn't for the pointer functions but only for the internal data

nadako commented 3 years ago

I made a separate issue here #16

nadako commented 3 years ago

I'm going to close this as it's not really an actionable issue. There's an experimental branch now here https://github.com/HaxeFoundation/haxe/pull/10128 where we can discuss and refine API.