Re: Object Oriented OS
Posted: Fri Jun 13, 2014 3:29 am
Hi,
For software to "understand" (decipher) plain text you need a scanner and a parser (and it should be no surprise that scanner and parser are the first 2 pieces of a typical compiler). This isn't just for compilers though - any decent IDE will also need a scanner and parser to do "fancy features" like simple syntax highlighting (and intellisense, autocomplete, tooltips, etc). By storing source code in a binary form (e.g. as "tokens") you don't need a scanner and can improve the efficiency of both IDE and compiler. In addition, (at least in my experience) this reduces source code file sizes to about 80% of the "plain text" equivelent.
Note: You can go one step further and store source code as an abstract syntax tree (in binary form). This is even more efficient (less processing in IDE and compiler) and more flexible (as it's language syntax independent). However; it turns out that when programmers are writing source code there's a lot of temporary/intermediate states where the source code isn't valid (or representable in AST); and storing source code as AST ends up being inconvenient. For a simple example, a programmer might write "if (foo == bar) { " (without any '}') and then save the file and go to bed; and then add more code (including the missing '}') the next day.
Basically, plain text is bad. In 1960 someone was too lazy to define a proper source file format and provide a suitable IDE, so they made it work with generic text editors. This became "the way it's done"; and we've been cursed with poor tools and poor efficiency ever since due to a combination of cowardice and laziness. Ironically, tools programmers create for other people (e.g. word-processors, spreadsheets, image file editors, etc) all have suitable file formats and editors (and don't use "plain text") - it amazes me that programmers can't do the same for their own tools.
Now; the difference between plain text and XML is that XML is worse for everything. It's less human readable for people, and less efficient (more expensive for scanning and parsing, and larger file sizes) for computers. The only "benefit" that XML has is that it allows the developer to sacrifice quality to reduce development time. Basically, XML/XSLT are tools that allow lazy/incompetent people to create crap.
Cheers,
Brendan
Intellisense, autocomplete and tooltips are only minor conveniences; while hideously unusable syntax is an extreme inconvenience. The advantages don't justify the disadvantages in the slightest.SpyderTL wrote:I'm not writing an IDE. There are plenty out there that are very good at editing XML files. If I can use Visual Studio, or Eclipse, or XCode, or XmlPad, and they already have intellisense, autocomplete, tooltips and can transform XML files using XSLT, why not just use one of them?
Let's talk about plain text and efficiency.SpyderTL wrote:The whole XML idea is based on the idea that code is actually data, and XML happens to be really good at storing data.
For software to "understand" (decipher) plain text you need a scanner and a parser (and it should be no surprise that scanner and parser are the first 2 pieces of a typical compiler). This isn't just for compilers though - any decent IDE will also need a scanner and parser to do "fancy features" like simple syntax highlighting (and intellisense, autocomplete, tooltips, etc). By storing source code in a binary form (e.g. as "tokens") you don't need a scanner and can improve the efficiency of both IDE and compiler. In addition, (at least in my experience) this reduces source code file sizes to about 80% of the "plain text" equivelent.
Note: You can go one step further and store source code as an abstract syntax tree (in binary form). This is even more efficient (less processing in IDE and compiler) and more flexible (as it's language syntax independent). However; it turns out that when programmers are writing source code there's a lot of temporary/intermediate states where the source code isn't valid (or representable in AST); and storing source code as AST ends up being inconvenient. For a simple example, a programmer might write "if (foo == bar) { " (without any '}') and then save the file and go to bed; and then add more code (including the missing '}') the next day.
Basically, plain text is bad. In 1960 someone was too lazy to define a proper source file format and provide a suitable IDE, so they made it work with generic text editors. This became "the way it's done"; and we've been cursed with poor tools and poor efficiency ever since due to a combination of cowardice and laziness. Ironically, tools programmers create for other people (e.g. word-processors, spreadsheets, image file editors, etc) all have suitable file formats and editors (and don't use "plain text") - it amazes me that programmers can't do the same for their own tools.
Now; the difference between plain text and XML is that XML is worse for everything. It's less human readable for people, and less efficient (more expensive for scanning and parsing, and larger file sizes) for computers. The only "benefit" that XML has is that it allows the developer to sacrifice quality to reduce development time. Basically, XML/XSLT are tools that allow lazy/incompetent people to create crap.
XSLT might be good at transforming something neither humans nor computers want into something else that neither humans nor computers want. This is completely and utterly useless for when you want to "compile" a program into a bunch of byte codes (or any other case that involves transforming something humans want into something computers want).SpyderTL wrote:And XSLT just happens to be really good at "transforming" a single XML node into one or more different XML nodes, which just happens to be really useful when you want to "compile" a program into a bunch of byte codes.
Cheers,
Brendan