[pypy-dev] Syntax for the 'transaction' module

Armin Rigo arigo at tunes.org
Fri May 4 12:51:56 CEST 2012


Hi Laura,

On Thu, May 3, 2012 at 6:25 PM, Laura Creighton <lac at openend.se> wrote:
> This is an odd way to think.  Sort of like how the Copenhagen explanation
> for quantum mechanics implies that classical concepts can be used to describe
> quantum phenomenon.  You try, and try, and try to think that way until your
> brain hurts.  And one day you explode, and say 'there are no things here',
> 'there are no concepts', THERE IS ONLY THE MATH AND THE MATH WORKS.

Right, in a way, as long as you remember that this applies only to the
few people that need to dig under this particular cover.  The Rule #1:
we're writing a version of Python for general programmers, not for
computer scientists Haskell fans.  In fact almost everything about STM
should be hidden even to the authors of the interpreter, just like GC
is in PyPy.

So I suppose that the quantum mechanics analogy works well if we take
it this way: the quantum rules of the universe are strange and
unexpected, but most people don't actually need them.  You would need
to understand them in order to grasp --- say --- how a laser *really*
works, but not to build things on top of it, like a CD reader.   For
the latter, classical reasoning works fine.

> I fear that using multiple cores may be a similar problem to those who
> are so very used to sequential operation.  We need a non-sequential way
> to think, and so far we haven't been very good at this.

If by "we" you mean "the general programmers" and not "the STM
specialists", then I disagree :-)  The STM model gives a way for the
former people to continue to think in terms of sequential operations.
This is true even if --- as an implementation technique only --- it's
actually more complicated than that.  But after all it has been more
complicated than "sequential operations" for many years now, with
out-of-order CPUs that give the illusion of sequential execution.  And
similarly when writing in Python we usually forget things like the GC,
which gives automatic memory reclaim, or (from another point of view)
the illusion of infinite storage space.  It is all just an
implementation technique, not something that the programmer has to
tweak his brain around before taking the next step.


A bientôt,

Armin.


More information about the pypy-dev mailing list