Upayavira wrote:

On 30 Jun 2003 at 22:29, Sylvain Wallez wrote:

...



I suggested that components being heavyweight resource, allowing
them to cross continuation boundaries should be prohibited.
Automatic release doesn't seem a good solution to me, as it would
mean that script variables would hold released components, thus
leading to unpredictable behaviour (think about stateful pooled
components). So my opinion is to raise an error if there are some
unreleased components when a continuation is created. This will
allow users to quickly learn the safe practices related to
component management in flow scripts.



I tend to agree.


...



Once again, I agree that explicit release is very unnatural. But
automagic release is good only if we can have some automagic restore.
For this we can have getComponent() actually return a proxy to the
real component, and have the proxy do a release/lookup when a
continuation is suspended/reactivated. But as elegant this may seem,
this won't work : stateful components have... a state, and a
release/lookup cycle destroys this state.

So I don't see any other solution...



How about defining a FlowSafe interface (contains no state and can be released/looked up transparently), and maybe a FlowSerializable interface (has a way that the state can be stored into the continuation and then restored, all transparently?




Continuations do not serialize state. Continuations restore the program counter and cause you to retain references to function invocations and local variables, however they do not "roll back" the values of those variables.




Reply via email to