[darcs-users] Language aware darcs

David Roundy droundy at abridgegame.org
Wed Jan 12 13:49:52 UTC 2005


On Wed, Jan 12, 2005 at 06:46:58PM +1100, Nigel Rowe wrote:
> On Wed, 12 Jan 2005 14:46, Michael Conrad wrote:
> > Suppose I have an automatic code formatter, and I run it after every
> > checkout. I then no longer care about whitespace.  In fact, it would be
> > advantageous in this situation if darcs didn't record any data at all about
> > whitespace or line numbers, and instead only managed the tree of data
> > generated by a parser.

You could work like this, but most people won't want to.  Often the
formatting of the code goes a long way towards making it easier to
understand what the code is doing, or why.  For example, in "real work"
code, I often have equations like

Qinverse = beta*hbar*omega * (nu*omega/(nu*nu - omega*omega)) * f(hbar*omega);

The spacings group together unitless quantities, so I can easily see that
the entire result is unitless.  If you convert this (via a pretty printer)
to

Qinverse = beta*hbar*omega*(nu*omega)/(nu*nu - omega*omega)*f(hbar*omega);

it will be less readable, and I won't appreciate it.

> > > > > Also, you can't just parse the file into its grammar, since you need
> > > > > to be able to precisely reproduce the original file.  In C,
> >
> > which you wouldn't, if you only cared about code correctness.
> 
> What about comments?  In my opinion an *important* part of the code, but one 
> that has nothing to with the parse tree of the code.

And very often whitespace-sensitive...
-- 
David Roundy
http://www.darcs.net




More information about the darcs-users mailing list