Tuesday, May 01, 2007

Why calm down ?

I'm long enough in the tooth now that there are few enough things to get me screaming at the PC, the Google bar's habit of stealing focus in Firefox is one of them, but this post by GraemeF was definitely another.

I got suckered into reading it by the mention of "MetaCode" in the title, which remains a fascinating idea, but the feeling crept up that here was someone with all the right questions, and all the wrong answers. Well ... must be nice, some of the right answers, but for the wrong reasons.

"Code has structure. Code is structure." ... "Plain text has no structure".

But, you see it is not plain text - it's program text, which does have structure. It is not saved as *.txt, but as *.py (YMMV), which automagically imposes a structure on it for the two readers which are going to open it: interpreters (YMMV again) and coders.

Graeme goes on to propose storing the program source in a structured format as XML (which is, of course, not the answer), but this does not provide any additional structure over the program text, simply rewrites it in a less legible format. Indeed XML subtracts structure - it does not provide any translation for the meanings behind an AST's hierarchy, just a hierarchy. A block of code inside a while is not the same thing as a block of code inside a for, and a block of code inside Python's for is not the same as a block of code inside C++'s for.

There exists no one language to reduce them all. So the XML has to by a C-xml, C++-xml, python-xml, and indeed a python-2.5.1-xml, python-2.5-xml, ...

Of course Graeme, and his ilk, dreams of the marvelous things which can be done with the source once it has been bastardised into XML, such as
  • manipulating the code as code
  • re-produce the original source
  • produce documentation
  • edit it with an editor like XML spy to enforce structural integrity
But
  • that's what LISP is for, and no-one else seems to need it
  • that's what the original source is for
  • that's what Doxygen, JavaDoc, ... is for
  • that's what any decent source-code editor is for

Labels: , , ,

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home