[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

autoformating code

From: Jason Elliot Robbins <jrobbins_at_collab.net>
Date: 2000-05-01 02:40:09 CEST

Actually a better solution for the (far) future would be to separate
program logic from presentation (e.g., indentation, tabs v. spaces,
line breaks, etc.).

In this scheme, the code would be stored in the repository in some
connonical form based on the syntax tree. The formating that
developers see is based on their personal prefernces. Commands like
'cvs diff' and 'cvs commit' would look at changes to the syntax tree
rather than the actual characters in the source file. This could also
make repositories even more dense and provides one big step toward
more logical (rather than line-based) diffs.

The reasons why this is impractical are that: (1) The version control
system needs to (directly or indirectly) parse the source files which
means that it needs to (directly or indirectly) know about which
langauge is being used for each source file. And, (2) developers lose
the ability to use formatting to express a point (in the cognitive
psychology of design, this is called "secondary notation").

Problem (1) could be overcome by limiting the set of languages that
are supported: if you use C, C++, java, makefiles, xml, html, or a few
others then it will work; otherwise you need to make a languge
binding, or you are stuck with formating your code as usual.

Problem could be overcome if certain sections of the code were marked
with something like <pre>, to indicate that their formatting should be
considered part of the version.

Since the early 1980's, tons of researchers have built AST-based
(abstract-syntax-tree) approaches to source code environments.
InterLisp-D is the most famous. Others include PAN, Centaur, and The
Cornell Snythesing Generator. A more recent attempt is the Sheets
environment at CMU (formerly called Gwendin, spelling?). None of
these have ever been widely used. If we do some conservative level of
support for this and it adds a little value, we will be seen as being
_very_ different and interesting.

jason!

======================================================================
Jason Robbins, Ph.D. Collab.Net is hiring open source developers!
Senior Software Engineer http://www.collab.net/jobs
======================================================================
Received on Sat Oct 21 14:36:04 2006

This is an archived mail posted to the Subversion Dev mailing list.