I wonder if we can reduce this to just one, namely to Stack. Instead of remembering Thread->Continuation association, we can remember Thread->Stack association. We then replace Continuation.currentContinuation() with Stack.currentStack(), and we can also move relevant flags (like restoring/capturing) to a Stack object.

This also has a nice side-effect of moving methods like isCapturing/ isRestoring to a non-API package.

Today, those methods are defined as public methods of Continuation, as a part of the API class, even though they aren't supposed to be called by applications.

In this way, we can also make the Continuation truly immutable.

Does this sound reasonable?

Well ...it does sound reasonable - except that
isRestoring/isCapturing feels also a bit awkward
inside the Stack class.
Would have been nice to keep that one clean :-/

But on the other hand a clean Continuation interface
and saving some instructions on the bytecode level
does sound very tempting.

...we could also have a specialized Stack with
those flags extending the basic Stack implementation.

WDYT?

cheers
--
Torsten

Attachment: PGP.sig
Description: This is a digitally signed message part

Reply via email to