CSAIL Research Abstracts - 2005 link to http://publications.csail.mit.edu/abstracts/abstracts05/index.html link to http://www.csail.mit.edu
bullet Introduction bullet Architecture, Systems
& Networks
bullet Language, Learning,
Vision & Graphics
bullet Physical, Biological
& Social Systems
bullet Theory bullet

horizontal line

Programming with Direct-Manipulation Semantics

Jonathan Edwards

Introduction

Representing programs as text strings makes programming harder then it has to be. The source text of a program is far removed from its behavior. Bridging this conceptual gulf is what makes programming so inhumanly difficult – we are not compilers. Subtext is a new medium in which the representation of a program is the same thing as its execution. Like a spreadsheet, a program is visible and alive, constantly executing even as it is edited; edits are coherent semantic transformations.

Approach

Instead of parsing text with a grammar, a semantic model is maintained through a direct-manipulation user interface – WYSIWYG semantics. This approach is merely the standard model/view architecture applied to programming language design. It frees the representation of programs from the limitations of paper-centric notations such as text and diagrams. Instead these notations become a presentation layer on top of much richer underlying structures. The insight is that text is a great user-interface technique, but a poor data structure for encoding program semantics.

The primary structure of the model is a tree, and the metaphor of the user interface is correspondingly an indented outline. There are two forms of structure that cross-cut the tree: links and copies. Links equate pairs of nodes in the tree, serving as constants, variables, and arguments. Any subtree can be copied anywhere else in the tree (including recursively within itself, which is lazily infinite). Both links and copies are constructed in the user interface with drag-and-drop or copy-and-paste operations. Execution is through reactive mutation: changes to inputs cause changes to outputs in response. Notably absent are symbolic names, the workhorse of textual notation, which are replaced by immediately-bound explicit links. This framework unifies traditionally distinct programming tools and concepts: there is no difference between run-time and edit-time, and no need for separate debugging, testing, building, and version-control tools. Programming becomes more akin to using a spreadsheet than a keypunch.

Progress

An experimental prototype implements an untyped first-order lazy pure functional language. The language has a novel blend of prototypical and functional semantics. This experiment serves as a proof of concept of direct-manipulation semantics without grammar or names.

Exploring the addition of higher-order functions uncovered a pleasing generalization: higher-order copying. If copying relationships themselves are subject to copying, then linking can be seen as a specialized form of copying. Everything then boils down to copying. Programs are constructed by copying and executed by copy flow: the projection of changes through copies. The simple idea of copying develops into a framework of higher-order continual copying of trees that serves as both a model of computation and a model of the process of programming itself.

Future

Ongoing work is the formalisation of the theory of higher-order tree copying, and its implementation in a second version of the prototype. This generalization will enable higher-order functions and some novel constructions. Ancestral structures are a new primitive data type that combines the features of lists and records, along with unproblematic multiple inheritance. Rather than depending on symbolic names or ordinal positions, structures are related definitively through their ancestry of copying and editing operations. Adaptive conditionals are a new conditional construct that uses first-class program edits to dynamically adapt behavior, essentially a hygienic form of self-modifying code. Mutable state is a major open issue to be investigated.

References

[1] Jonathan Edwards. Example Centric Programming. In Companion to the 19th annual ACM SIGPLAN conference on Object Oriented Programming Systems, Languages, and Applications (OOPSLA'04 Onward) Vancouver, BC, CANADA, October 2004. [PDF]

[2] Jonathan Edwards. Subtext: Uncovering the Simplicity of Programming. Submitted to Object Oriented Programming Systems Languages and Applications Onward 2005 (OOPSLA'05 Onward). [PDF]

horizontal line

MIT logo Computer Science and Artificial Intelligence Laboratory (CSAIL)
The Stata Center, Building 32 - 32 Vassar Street - Cambridge, MA 02139 - USA
tel:+1-617-253-0073 - publications@csail.mit.edu
(Note: On July 1, 2003, the AI Lab and LCS merged to form CSAIL.)