开发者

Everything now is XML - but programming is still done with some legacy files obeying complicated syntax

Why is this ? Gcc is now providing a "C-to-XML" conversion since XML is more easily parsed.

Couldn't we benefit if our source code was XML?

Of course, nobody want's to edit XML files manually开发者_开发问答 - but that's what IDEs are made for.

  • Would some programming language with less syntax (LISP, Smalltalk) better map to XML?


 <comment>
 <statement-of-argument>
    I don't think everything is XML.
 </statement-of-argument>
 <p>
    You still see plenty of plain text and other forms of encoding.  
    I think you're just being <pejorative>silly</pejorative>.
    Or perhaps imagining things.
 </p>
 </comment>


Couldn't we benefit if our source code was XML?

Let me take this question in its broader sense: suppose that our favorite programming language had a standard machine-readable form that admitted only well-formed trees. Couldn't we benefit?

  1. It was done with Ada in the 1980s, with a standard form for abstract-syntax trees (I believe it was called DIANA). There was a modest benefit for those writing tools to analyze Ada.

  2. Other experience gotten during the 1980s, with the Cornell Program Synthesizer and related tools, showed that for a developer, you must have the ability to edit a "thing" that is not a syntactically correct program. Remember, we are typists first, programmers second, and what we learned from the Cornell Synthesizer experience was that using any IDE that forces you always to maintain a syntactically correct program (think: a well-formed XML tree) is like dragging around a ball and chain.

    Good programmers are really, really good at typing text fast. Any representation or IDE which takes away that advantage had better offer some compelling compensating advantages. For XML, I don't see what those compensating advantages might look like.

  3. The one thing you gain with XML is that it's easier to write a parser. (You still have to write one, but it's easier.) But with the computing power we have gained since the 1980s, and with the plethora of new parsing techniques that can exploit that power, parsing (converting linear text to tree form) is just not that big a deal any more. All of the work in creating great tools is in analysis (type checking, pointer analysis, information flow, optimization, you name it) of the resulting trees. XML doesn't buy anything there.

I made my reputation working on compilers and related tools, and while I see some very modest benefits to having a standard representation of abstract-syntax trees, and would be willing to accept XML as such a representation, I can't see that the benefits would be worth the cost of agreeing on a standard.


Programming languages are for programmers' convenience, not for ease of parsing.


Have fun with http://xplusplus.sourceforge.net/ :P

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜