[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-smalltalk] DynamicVariable in a Continuation
From: |
Derek Zhou |
Subject: |
[Help-smalltalk] DynamicVariable in a Continuation |
Date: |
Mon, 23 May 2011 23:20:07 -0700 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Hi All,
It looks like the sematic of DynamicVariable changed not very long ago; it
was based on Notification, but it now just uses a ProcessVariable. Here is a
simple testcase:
DynamicVariable subclass: Seed [
].
Eval [
|b g1 g2|
b := [:v | v + Seed value].
g1 := Generator on: [ :g |
|v|
v := 0.
Seed use: 2 during: [
[ g yield: v.
v := b value: v ] repeat ]].
g2 := Generator on: [ :g |
|v|
v := 0.
Seed use: 3 during: [
[ g yield: v.
v := b value: v ] repeat ]].
Transcript nextPutAll: '%1 %2 %3 %4' % {
g1 next.
g2 next.
g1 next.
g2 next}; nl.
]
It used to yield "0 0 2 3" but yields "0 0 3 3" now. I'd think "0 0 2 3" is
the correct answer; the documantion specifically mentioned stackframes so
the stackframes hopping from the Continuation should affect the variable,
right?
Derek
- [Help-smalltalk] DynamicVariable in a Continuation,
Derek Zhou <=