Falling in love with D, but...

Peter Verswyvelen bf3 at telenet-REMOVE-THIS-ANTI-SPAM.be
Wed Apr 11 00:59:10 PDT 2007


Such a code analyzer is a really useful tool indeed.

But as what I actually meant, is more like what Dan said: instead of taking text
as the format of the "source" code, we should use a code-DOM or something
structured like an AST, where symbols are either defined or referenced directly by
pointer/id, not by name.  Code style and formatting is then pure meta data, just
present to reconstruct a textual view in a particular style. Given other
presentation related metadata (e.g. node X,Y positions), the code could just as
well be presented using a graph with nodes and edges. In the fantastic "structure
and interpretation of computer programs" video lectures made in the eighties this
was already mentioned somewhere. If you want a crash course in programming, this
is still amazing stuff:
http://video.google.com/videoplay?docid=5546836985338782440&q=structure+and+interpretation+of+computer+programs

Now this already existed on the Commodore 64, in an assembly language editor: when
you typed a line of assembly, it would be parsed immediately, and symbols got
resolved lazely on the fly. There was no need to parse the whole program anymore,
just linking was needed, so it was really fast (I believe the program's name was
"Turbo Assembler", but it had nothing to do with Borland). Also, the code got
automatically formatted and syntax highlighted, and symbol lookup was easy.
Ofcourse, this is really simple because of the simplicity of assembler, but the
principle remains.

Todays refactoring tools and intelligent editors have a really hard time to sync
their internal code-DOM with the text; just deleting a curly bracket messes up the
whole DOM, making refactoring a fuzzy adnd dangerous concept; clearly a more
structured (and faster!) way of entering code could be enforced, but then of
course we all should adapt, and we don't like that, the tools should adapt to us
no? ;-)



More information about the Digitalmars-d mailing list