A critic of Guido's blog on Python's lambda

David C. Ullrich ullrich at math.okstate.edu
Mon May 8 23:06:49 CEST 2006


On 08 May 2006 12:53:09 -0700, tfb at conquest.OCF.Berkeley.EDU (Thomas
F. Burdick) wrote:

>Ken Tilton <kentilton at gmail.com> writes:
>
>> No, you do not want on-change handlers propagating data to other
>> slots, though that is a sound albeit primitive way of improving
>> self-consistency of data in big apps. The productivity win with
>> VisiCalc was that one simply writes rules that use other cells, and
>> the system keeps track of what to update as any cell changes for
>> you. You have that exactly backwards: every slot has to know what
>> other slots to update. Ick.
>
>No no, that's fine and the way it should be: when you change a slot,
>it should know who to update.  And that's also the way it works in
>Cells.  The trick is that Cells takes care of that part for you:

I'm glad you said that - this may be what he meant, but it seems
more plausible than what he actually said.

> all
>the *programmer* has to care about is what values a slot depends on --
>Cells takes care of inverting that for you, which is important because
>that's a job that a computer is much better at than a human.

Fine. I suppose that is better; if b is going to return a + 1
the fact that this is what b returns should belong to b, not
to a. So a has an update list including b, so when a's value
is set a tells b it needs to update itself.

If we're allowed to pass (at some point, to some constructor
or other) something like (b, a + 1, [a]), which sets up a
cell b that shall return a + 1, and where the [a] is used
in the constructor to tell a to add b to a's update list
then this seems like no big deal.

And doing that doesn't seem so bad - now when the programmer
is writing b he has to decide that it should return a + 1
and also explicitly state that b shall depend on a; this
is all nice and localized, it's still _b_ telling _a_ to
add b to a's update list, and the programmer only has
to figure out what _b_ depends on when he's writing _b_.
Doesn't seem so bad. 

But of course it would be better to be able to pass just 
something morally equivalent to (b, a + 1) to whatever 
constructor and have the system figure out automatically 
that since b returns a + 1 it has to add a to b's update 
list. There must be some simple trick to accomplish that 
(using Python, without parsing code). (I begin to see the 
point to the comment about how the callbacks should fire 
when things are constucted.) Exactly what the trick is I 
don't see immediately.

In Cells do we just pass a rule using other cells to
determine this cell's value, or do we also include
an explicit list of cells that this cell depends on?

************************

David C. Ullrich



More information about the Python-list mailing list