Wednesday, September 24, 2008

Worlds: Controlling the Scope of Side Effects

The state of an imperative program—e.g., the values stored in global and local variables, objects’ instance variables, and arrays—changes as its statements are executed. These changes, or side effects, are visible globally: when one part of the program modifies an object, every other part that holds a reference to the same object (either directly or indirectly) is also affected. This paper introduces worlds, a language construct that reifies the notion of program state, and enables programmers to control the scope of side effects.

This paper is from the Inventing Fundamental New Computing Technologies project at the Viewpoints Research Institute (founded by Alan Kay).

Seems like it is intended to be quite a coarse-grained approach to program state. A little like a developer checking out a copy of a project from a version control system, making changes and either committing or reverting back.

3 comments:

Anonymous said...

Actually, it ranges from extremely fine-grained (e.g. better ways to do "try", backtracking, etc.,) to very coarse-grained (as you mention).

-- Alan Kay

Anonymous said...

Sounds a lot like STM.
http://research.microsoft.com/~tharris/
http://www.cl.cam.ac.uk/research/srg/netos/lock-free/

Also similar to distributed object caches.
http://terracotta.org/
http://www.jboss.com/products/jbosscache
http://www.oracle.com/technology/products/coherence/

See also "Persistent Store Interface", Steven Blackburn
http://cs.anu.edu.au/~Steve.Blackburn/pubs/abstracts.html
http://cs.anu.edu.au/~Steve.Blackburn/pubs/papers/thesis.pdf

Also has similarities to MVCC like in PostgreSQL and Oracle and MySQL
via Falcon.
Jim Starkey is the lead developer of Falcon who also implemented
Interbase - which spawned the open source Firebird. All with MVCC.

Brad Clow said...

I also thought of STM when I read the paper, but haven't really considered their similarities.

Secondly, I wondered (but haven't really considered) why not simply write more pure functions (where it is possible) and thereby remove the whole need to manage state in those situations.