A critic of Guido's blog on Python's lambda
Ken Tilton
kentilton at gmail.com
Wed May 10 10:58:36 EDT 2006
sross wrote:
>>I do wonder what would happen to Cells if I ever want to support
>>multiple threads. Or in a parallel processing environment.
>
>
> AFAIK It should be fine.
> In LW, SBCL and ACL all bindings of dynamic variables are thread-local.
>
Ah, I was guilty of making an unspoken segue: the problem is not with
the *dependent* special variable, but with the sequentially growing
numeric *datapulse-id* ("the ID") that tells a cell if it needs to
recompute its value. The ID is not dynamically bound. If threads T1 and
T2 each execute a toplevel, imperative assignment, two threads will
start propagating change up the same dependency graph... <shudder>
Might need to specify a "main" thread that gets to play with Cells and
restrict other threads to intense computations but no Cells?
Actually, I got along quite a while without an ID, I just propagated to
dependents and ran rules. This led sometimes to a rule running twice for
one change and transiently taking on a garbage value, when the
dependency graph of a Cell had two paths back to some changed Cell.
Well, Cells have always been reengineered in the face of actual use
cases, because I am not really smart enough to work these things out in
the abstract. Or too lazy or something. Probably all three.
kenny
--
Cells: http://common-lisp.net/project/cells/
"Have you ever been in a relationship?"
Attorney for Mary Winkler, confessed killer of her
minister husband, when asked if the couple had
marital problems.
More information about the Python-list
mailing list