[Seaside-dev] [Dolphin] Assertion failed on WAFlowPlatformTest>>testSuspendCallbackDo

GallegO fxgallego at gmail.com
Mon Sep 14 16:18:16 UTC 2009


Hi list,

One of the failing tests we have is #testSuspendCallbackDo.
Maybe the test is intended or implemented for Pharo/Squeak but I'm in
trouble with the Continuations (full) and I want resolve this failure
first before take any possible wrong assumptions.

First, I have implemented #suspendFlowDo: as simply as:

suspendFlowDo: aBlock

	^WAContinuation currentDo: aBlock

I'm not sure if it is correct but in the practice works well... but
#testSuspendCallbackDo is failing:

testSuspendCallbackDo
	| continuation result |
	continuation := nil.
	self withCallbackContinuationDo: [ :cc | continuation := cc ]
resultBlock: [ :r | result := r ].
	self assert: continuation notNil.
	self evaluateCallbackContinuation: continuation with: 123.
	self assert: result = 123

This is a bit confusing but after the statement
    self withCallbackContinuationDo: [ :cc | continuation := cc ]
resultBlock: [ :r | result := r ].
was executed the local "continuation" has aWAContinuation as value and
the assert succeeds,
after the statement
	self evaluateCallbackContinuation: continuation with: 123.
is executed and the continuation resumes, but this time the local
"continuation" has nil.

Which is the expected behavior?

Dolphin, in it's Continuation class comment, say that local variables
are not shared

"....  The copy shares no temporary variable (or stack) slots with the
source, and so is not affected by the activity of the source after the
copy is taken. It is worth bearing in mind, however, that any side
effects of operations performed during the compuation (for example the
manipulation of global counters) may introduce undesirable
interdependencies between the continuations..."

Any help?

Thanks in advance.

Jose Sebastian Calvo
PD: Sorry for mi English


More information about the seaside-dev mailing list