stack-switching icon indicating copy to clipboard operation
stack-switching copied to clipboard

Function coloring?

Open pannous opened this issue 1 year ago • 2 comments

Does this approach avoid function coloring? That is: do legacy calls of functions containing yield instructions just treat these as nop?

pannous avatar Nov 08 '23 06:11 pannous

Neither. We definitely don't want function coloring, i.e, a static effect system. But stack switching does not need that. In all variants of the proposal circulated so far switching stacks works without static knowledge of such effects. In fact, that is a main point of the proposal, because in the presence of such knowledge, you can already implement the equivalent semantics producer-side, e.g., through partial CPS conversions, or the approach taken by Asyncify.

rossberg avatar Nov 08 '23 08:11 rossberg

Does this approach avoid function coloring? That is: do legacy calls of functions containing yield instructions just treat these as nop?

@pannous For a simpler answer: It's based on (a variant of) continuations. Continuations color runtime contexts, not functions.

As for suspend outside a typed continuation, it would trap at rumtime.

dead-claudia avatar Nov 08 '23 11:11 dead-claudia

Closing this as answered, but feel free to reopen if there are follow-up questions.

tlively avatar Aug 27 '24 16:08 tlively