Slashdot Mirror


Are Extensible Programming Languages Coming?

gManZboy writes "Programming writer and instructor Greg Wilson is proposing that the next generation of programming languages will use XML to store not only such things as formatting (so you can see indentation your way, and I can see it my way, via XSLT) but even programmatic entities -- like: <invoke-expr method="myMethod"><evaluate>record</evaluate></invoke-expr>. Wacky, but perhaps wacky enough to be possible?"

55 of 838 comments (clear)

  1. Extensible? by jawtheshark · · Score: 5, Insightful
    My programming languages were always extensible. Be it over procedures or functions, objects and inheritance, fuck even the good old programmable interrupts did the job! Programming languages don't limit, they enable you to do what you want.

    Look, I can understand XML to convey data.... but honestly, you don't need to use XML for everything under the sun. Proven old good methods work just fine, thank you very much.

    --
    Ahhh...the great dumpster continuum. Many a free computer will be found there. -- sowth (748135)
    1. Re:Extensible? by eln · · Score: 5, Insightful

      XML now is what OOP was 15 years ago: Useful for some things, but shoehorned into every possible application, whether it actually made any sense or not, and whether or not it made things easier or more difficult.

    2. Re:Extensible? by Anonymous Coward · · Score: 4, Insightful

      15 years ago? That's where OOP is now.

    3. Re:Extensible? by Umbral+Blot · · Score: 4, Insightful

      I for one welcome new tools. Well that is if they are tools and not straight jackets. For example a new language construct (for eaxmple generic classes in Java 5) is an example of a good tool. You can use if if you need it, but you can also ignore it. Perhaps XML syntax might be useful in some areas (although I can't see how ...), but forcing the entire language to be in it seems too much like a straight jacket to me.

    4. Re:Extensible? by Cthefuture · · Score: 4, Insightful

      I could not agree more.

      At it's core XML is nothing. It's so generic, so basic, so flexible, whatever you want to call it, that it's completely pointless. Yes, you read that right, the structure is so flexible that it's not really structure any more.

      XML is just dumb in general. It's like saying: I've got this new, exciting, powerful data container called "The English language."

      Yeah, OK, whatever.

      --
      The ratio of people to cake is too big
    5. Re:Extensible? by Anonymous Coward · · Score: 1, Insightful

      At it's core XML is nothing. It's so generic, so basic, so flexible, whatever you want to call it, that it's completely pointless. Yes, you read that right, the structure is so flexible that it's not really structure any more.

      How did this get to insightful? You don't know what you are talking about. Oh, I forgot, Slashdot has some odd anti-XML bias.

      XML doesn't deal with structure beyond organising elements into a hierarchy. That's it. Nobody (with a clue) has ever suggested otherwise.

      The benefits XML brings are a standard, regular syntax that can be parsed without too much overhead, and the related technologies, like XPath, that make it dead easy to manipulate documents.

      No, it's not magical technology that fixes everything wrong with a project. Only clueless PHBs say things like that. So attacking it for simply being was it was planned to be all along is pretty damn dumb.

    6. Re:Extensible? by conradp · · Score: 4, Insightful

      XML has definite value, but that value has just as definitely been overhyped.

      I bet all of us have written code to save and restore configuration files or data files of some sort or another. You start with a flat file, if you're really dumb you store values implicitly by position, if you're a bit more clever perhaps you opt for using keyword/value pairs. Later you decide you want to allow newlines in the values and need to write special code for that, so you use double-quotes. Then you decide you need double-quotes in your values, and you invent an escaping mechanism. After some more development you realize that some subset of your keyword/value pairs has to be multiply-instanced, so you need some mechanism to have "objects" each with their own keyword/value pairs. And so on... Eventually someone on another project needs to read your file, and you have to explain all these idiosyncrocies to them so they can write some parsing code...

      XML simplifies all that by defining a common syntax in which you can encode your information. It's easy to gradually expand your format by adding XML fields, and if you show the file to anyone else they instantly get a pretty good idea of what the information means; plus they have access to a bunch of libraries to parse it (SAX and DOM) and there are predefined ways to escape newlines, quotes, braces, and so forth.

      Of course, XML is only a syntax. There are a billion other syntaxes that could probably accomplish the same things, but somehow XML became the standard; that in and of itself has value because everyone uses it and knows how to read and write it. But programs can't interoperate and read and write the same files until they agree on symantics, i.e. what tags will be where and what each field really means. I've encountered this several times, some customer says "write the data in XML format" and I have a hard time explaining to them that, yes, we can write it in XML, but that's not sufficient information to define the file format, that's really just the beginning.

      --
      "To be absolutely certain about something, one must know everything or nothing about it." -- Olin Miller
    7. Re:Extensible? by conradp · · Score: 2, Insightful

      Thank you very much, I think you've just proven my point better than I ever could have!

      --
      "To be absolutely certain about something, one must know everything or nothing about it." -- Olin Miller
    8. Re:Extensible? by Decaff · · Score: 2, Insightful

      0 = new tree
      1 = string ASCII
      2 = String Unicode
      10 = signed int
      20 = unsigned int
      30 = floating point number (format 1) 31 = floating point number (format 2) ...
      I basicly keep aything under 10,000 as uneversal format's and use stuff over that for odd adhock stuff which I don't have time to deconstruct.


      If I had come across one of your configuration files, and did not have this key to the meaning, I would have had no idea how to interpret it.

      This is exactly the argument for using XML.

    9. Re:Extensible? by Decaff · · Score: 2, Insightful

      XML is not Human readable on anything ther than the most simple app.

      Having used XML extensively, I would disagree with this.

      And do you want people to be able to mess with config files when they don't have the documentation?

      But that is exactly why XML is useful:
      1. A configuration file will most likely have a DTD or schema, so that if you modify it, those modifications can be validated, as can the structure of the entire XML file.
      2. XML is extensible. It is perfectly acceptable to add your own tags, which give additional meaning to the file. Tags which aren't understood by a particular application will be safely ignored.
      3. XML IS human readable: Which would you feel more confident editing:

      <setting type="integer">123</setting>

      or

      10,123

      (Was the indication for integer 10? I don't remember. Someone might tell me that '10' means 'integer', but there is nothing else to indicate this)

      Good XML will be self-documenting, but even bad XML is better than

      10,123

    10. Re:Extensible? by Decaff · · Score: 2, Insightful

      With your XML way you have no documentation directly in the file.

      You mean like:

      <-- This is a note about the following settings -->?

      If you have a config file all settings should be documented in there and if you have a data file you should be able to have one documentation for an example entry at the beginning of the file.

      I think you are missing the point. With a configuration file like this, you HAVE to have the documentation in there to interpret the settings. With XML you don't.

      The "name=value" syntax is a lot easier to parse than XML and allows you to store the settings in memory in the way you want.

      Why should you care how easy the file is to parse? Don't bother to parse it yourself - use an API like SAX - and then you can store the settings in whatever way you like.

      Some other points:

      The name=value syntax isn't portable or expandable. Suppose the name or value contains '='? You will need to define what delimiter should be used for the name and value. XML is a defined standard for delimiting values.

      This syntax does not allow for trees. XML can do this.

      How do you handle strings that require non-printable characters, like newlines? XML has a standard for this.

      Suppose you have put in the documentation about what format is and what the parameters mean and then the software is dispatched to a foreign country? XML is an international standard.

      Suppose someone else wants to add new settings to the configuration file. Will this prevent your software working? With their names of properties clash with yours? These matters are handled in XML.

      Finally, there is nothing in the file that would allow any software to automatically detect that this is a name=value file. XML always starts with <?xml.

      XML is an easy-to-use standard solution to these problems, with many well-supported high-quality libraries and tools to handle it. It can be as simple or complicated as you like. What is the objection?

    11. Re:Extensible? by ph1ll · · Score: 2, Insightful
      The World does not need better programming languages.

      The World needs better programmers.

      --
      --- "We've always been at war with Eastasia."
  2. Is this guy serious? by FyRE666 · · Score: 5, Insightful

    ...programmatic entities -- like: record. Wacky, but perhaps wacky enough to be possible?

    Hopefully, no. Christ almighty, why is there this surge in interest for pointless layers of abstraction on top of the code? It seems some people are desperate to do anything to avoid actual implementation (work?), prefering to dance around the periphery of a project, adding needless fluff and speedbumps. Honestly, will the addition of XML markup in source code REALLY help to advance a project, make the code more readable or avoid bugs?

    1. Re:Is this guy serious? by Anonymous Coward · · Score: 3, Insightful

      Oddly enough, all the tools you mention are already possible and exist today, without XML.

      XML has no value in and of itself. Standardized data formats may well be valuable, but there's nothing magic about angle brackets and slashes. A standardized binary format would be just as useful.

      Programming languages already have a standardized syntax. Having them also conform to XML syntax adds nothing. Heck, programming languages are also even human-readable, for those that still think that's an important feature of XML.

    2. Re:Is this guy serious? by IO+ERROR · · Score: 2, Insightful
      No. This is just needless complexity. XML is great for some things, but it is not the silver bullet for every problem in the known universe!

      In this case, XML will probably make programming much more difficult and code far less readable -- to humans. The compiler might like it a little better, but the compiler is supposed to serve us, not the other way around. The tool serves us. At least in an ideal world.

      In the real world we use tools to get work done. If the tools are inconvenient to use or not suitable to the problem at hand, they don't get used. For the sake of humanity, this needs to be killed now before he comes up with a prototype, and drives future generations of programmers to madness.

      --
      How am I supposed to fit a pithy, relevant quote into 120 characters?
    3. Re:Is this guy serious? by Coryoth · · Score: 4, Insightful

      I just skimmed the article a bit, but I believe the idea is that you write your code the way you want to but the code is translated into the xml format and stored that way. When you reopen it, it's translated back into your preferred syntax.

      So what we're really talking about is something like Microsofts CLR, Java's bytecode, or Parrot code, with the ability to de-compile it back into the language of your choice? We just get the added bonus that the "compiled" code is not actually compiled, and is stored in the most padded verbose unreadable format that could reasonably be arranged? Doesn't sound like a vast improvement.

      Jedidiah.

    4. Re:Is this guy serious? by Coryoth · · Score: 4, Insightful
      That is a good idea. And I can think of many other similiar features you might want for an editor / project development system. However I doubt XML will end up being the best solution. I would guess that the best solution would be a custom file format that was desgined for this reason.

      Brilliant idea. Let's start by just using parentheses for delimiters instead of all that stuff, and just have the first word inside the parentheses define the operation, and the other (space delimited, why not?) words simply be the list of arguments to be processed. That sounds nifty. Now lets take that example from the article and convert it into this condensed format...
      <cond>
      <test>
      <compare-expr operator="less">
      <field-expr field="age">
      <evaluate>record</evaluate>
      </field-expr>
      <evaluate>threshold</evaluate>
      </compare-expr>
      </test>
      <body>
      <invoke-expr method="release">
      <evaluate>record</evaluate>
      </invoke-expr>
      </body>
      </cond>
      becomes something like
      (if (< (field age (record)) (threshold))
      (body
      (release (record))
      )
      )
      Hmm, that looks oddly familiar... if we just changed a few of the keywords a litte.. I wonder if someone has thought of something like this before...

      Jedidiah
    5. Re:Is this guy serious? by mpcooke3 · · Score: 2, Insightful

      I wouldn't say that. most of the companies i work with supply data in XML formats. generally they're very easy to read/debug and process and using standard libraries.

      Some companies on the other hand try to give us proprietary binary data streams over tcp or incremental relational data dumps over TCP. Guess which i prefer.

    6. Re:Is this guy serious? by tomhudson · · Score: 2, Insightful
      Well, some xml fanboy must be pissed to mod the parent as a troll ... but xml has some serious flaws in respect to data representations for code.

      Try to modely objects and their instances in a multiple inheritance hierarchy in xml w/o getting REALLY redundant.

      xml is for people who think that multiple inheritance (think C++) is a mistake (they prefer single inheritance a la delphi or java - both of which then had to add mechanisms to work around the flawed single-inheritance model).

      Me, I'd rather go back to coding in assembler than try to fit everything into an xml world (can you imagine representing assembler mnemonics in xml? What a waste of time).

    7. Re:Is this guy serious? by tomhudson · · Score: 2, Insightful
      The *big* deal is why any serious programmer would even *want* to be able to transform his code. I've got better things to do with my time.

      If I disagree with how someone else formats their c code, I can always pass it through a "pretty-print" filter, or write my own, so no big deal there.

      If I want to code using c-style or c++-style syntax and then translate it into, say, java, again no big deal.

      But to even think that any tool I use has to "understand" the language is wrong. The only tool that has to have an understanding of the language is the compiler for that language (and me - but I'm a "tool" too :-).

      All this will lead to is (even more) sub-optimal code, as people try to "leverage" the supposed value of xml.

      In other words, when coding, keep in mind the general case (for future expandability/maintenance), but always program for the specific case. This whole "store your code as xml" thing has NO benefits over the original source, which you can always shuffle around and manipulate as you see fit. If you want to store it as xml, you can always either write your own converter, or use one that someone else has written.

  3. Oh, yeah, *that*'ll fly... by jonadab · · Score: 2, Insightful

    We all know how programmers like languages that require typing a lot of
    verbose and lengthy expressions. Y'ever notice how *popular* COBOL is?
    Did you notice how many more languages have copied Pascal's style of
    delimiters BEGIN/END versus the C style {/} or the lisp style (/), and
    how popular those languages are?

    It's different for data, because you don't type them in by hand most of
    the time; you write a program that generates them.

    --
    Cut that out, or I will ship you to Norilsk in a box.
  4. already have this by CastrTroy · · Score: 2, Insightful

    Most good IDE's already support autoformatting a document to fit the indenting and bracketing to the user. I don't see how putting formatting as a core part of the language will really help the language at all.

    Not to mention the fact that programming languages (not assembly) by definition, are extensible. Most programming languages provide loops, if statements, and ways to define classes, methods, and variables. Some programming languages provide standard libraries so you don't have to do everything from scratch. I don't see anything new that this will offer.

    --

    Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
  5. Re:Umm... by WD_40 · · Score: 2, Insightful

    Seriously. Isn't software bloated enough? Why obfuscate things further. Dumbest... idea... ever.

    --

    "With sufficient thrust, pigs fly just fine." -- RFC 1925

  6. Silly article by photon317 · · Score: 4, Insightful
    This article argues that next-generation programming systems can accomplish this by combining three specific technologies: -> Compilers, linkers, debuggers, and other tools that are frameworks for plug-ins, rather than monolithic applications. -> Programming languages that allow programmers to extend their syntax. -> Programs that are stored as XML documents, so programmers can represent and process data and meta-data uniformly.

    1 - Compilers with plug-in architectures - GCC anyone? I know, he probably means something quicker and easier than writing new front- and back- ends for the Gnu Compiler Collection, but the concept is already out there.

    2 - Just about any modern language does this to some degree depending on your definition. Under even the most rigorous definition of this, the good old language LISP does it with flair. Users can extend LISP syntax with ease, and user-added extended LISP syntax is virtually indistinguishable in style and functionality from the built-in elements of the language.

    3 - Since existing languages have a well-known syntax which is easily machine parseable (in fact, that's what the parser and compiler do every time you use them on your source code), existing computer languages are already in a format which allows easy conversion into other formats and representation, and the gathering of metadata. Converting semicolons, whitespace, and parentheses (or whatever your language of choice uses) to xml tags doesn't really change anything, except to make things uglier and harder to type.

    --
    11*43+456^2
  7. Re:I don't understand by Viking+Coder · · Score: 4, Insightful

    XML is certainly more portable than binary code

    That's a huge fricking lie that I wish would die.

    Your TCP/IP packets don't all start and end with < and >, and they seem to be fairly portable.

    Endian-ness and packing are not rocket science.

    --
    Education is the silver bullet.
  8. It's a LISP I tell you by ebunga · · Score: 2, Insightful

    S-expr's and xml are interchangeable, for the most part. Congratulations, you can now be a total degenerate and program in xmlisp.

  9. XML Lisp! by acidrain · · Score: 3, Insightful

    Wow, I never had this much trouble posting on slashdot before. Try making a joke in XML. Your screwed... First it rejects repeated tags and then silently deletes the tags it doesn't like.

    <parenthesis>
    <parenthesis>
    a
    <comma>
    b
    </parenthesis>
    c
    </parenthesis>

    --
    -- http://thegirlorthecar.com funny dating game for guys
  10. ASN.1 and XML by Anonymous+Cowherd+X · · Score: 5, Insightful

    Programs are written by humans and they should stay easily legible and comprehensive to humans. Going to such extremes as to use XML as the author of the article suggests would defeat that purpose, it's a common trap that people who get too deeply involved with something fall into - they want to make everything use the object of their obsession. I don't recall any ASN.1 zealots trying to push for something that extreme, but with XML there are more and more people who are pushing for XML to be where it should not.

  11. Aren't they already here? by Jesus+2.0 · · Score: 2, Insightful

    Don't certain crappy HTML-producing languages, for example CFML, already operate this way?

    For example (and yes, I've forgotten my crappy CFML syntax, so this is pseudo-crappy CFML (as opposed to crappy pseudo-CFML)),

    <CF-FOR INDEX="I" START="0" END="5" STEP="1">
    <CF-PRINT>%I%</CF-PRINT>
    <CF-IF CONDITION="I=3">
    <CF-PRINT>Aw yeah, baby, three!</CF-PRINT>
    </CF-IF>
    </CF-FOR>

    And, to expand upon my question from my subject:

    Aren't they already here? And aren't they already crappy?

  12. zerg by Lord+Omlette · · Score: 4, Insightful
    Reading the article, I don't think anyone would ever actually see the XML unless they edited the file w/ their own text editor. I think the point is that the editor adds and parses the XML for its own benefit. See, our text files were written in ASCII, now Unicode. Therefore, the evolution to a higher representation is (supposedly) logical. The best way to reason about it is a /. post I saw many moons ago, something like: "You wouldn't put ASCII on your résumé, would you? So why would you put XML?"

    If I'm wrong, then this might be slightly more interesting in the long run than, say, Cyclone, where you have to learn a tiny amount more of additional syntax to mark that "this pointer was meant to point to data, not code", "this pointer should not write beyond this boundary", "this function has no business mucking up its stack", etc.

    Alternatively, look at Visual Studio.NET.
    /**
    * @author Lord Omlette
    * zOMG WTF
    */
    vs.
    /// <comment>
    /// <author>Lord Omlette</author>
    /// zOMG WTF
    /// </comment>
    The latter is a bit more readable but more annoying to write. Better we have tools to generate this stuff for us.

    And then someone will come out of the woodworks to say "Knuth had Literate Programming back in the 80s, why the fuck aren't we using that?" but that's another rant altogether.
    --
    [o]_O
  13. Repeat with me: by Zangief · · Score: 3, Insightful

    -XML is not the panacea.

    -XML was made for comunication between different programs, not for humans to write or think in.

    -This was done before in LISP.

    10 times each morning. If in a week you are still thinking about this, call me back.

  14. Lisp: The Programmable Programming Language by Piquan · · Score: 2, Insightful

    If you think that extensible programming languages aren't already here, then read On Lisp (some familiarity with Lisp is necessary).

  15. Why do people think XML is good for this stuff? by Tom7 · · Score: 2, Insightful

    Why do people love to use XML for all sorts of inappropriate things?

    XML does not make data immediately understandable. All it does is remove one parsing problem, leaving the much more important problem of understanding the meaning of the tags, data, and their combination.

    XML might make sense as a compiler intermediate format, or even as a source archive format, but it has essentially nothing to offer in tems of extensible syntaxes (except for reminding us that the surface syntax of a programming language and the abstract syntax it represents can be as independent as we choose) or semantics in programming languages. (By the end of the article, this is essentially the point he comes to, with the only argument for XML being that it is popular.)

  16. You didn't actually read the article, right? by antientropic · · Score: 2, Insightful

    There are now 140 or so comments, and it is painfully clear from them that almost none of the posters have actually bothered to read the article. If they had, they wouldn't be confused on the following:

    • The article does not propose that we all start writing our programs as kinds of abstract syntax trees in XML notation. The XML is just the storage format. In fact, the extensibility that the author claims this will brings would make programs less verbose, not more.
    • "Lisp S-expressions already do that!" The author acknowledges this, to an extent. But as he states, those never caught on, while XML can now be processed by lots of tools, so there is a new opportunity now.
    • There are also some bizarre claims about extensibility either being a feature of all programming languages, or being unnecessary. That's silly, of course. What this is about is the ability to add new abstraction mechanisms to a language, which is really what the entire evolution of programming languages has been about. Procedures, OOP, templates, macros, modules, lambdas, etc, are all ways to cut down on repetitiveness and the number of boring details you have to think about. With an extensible language you can do that sort of thing yourself (within reason), while tools such as debuggers will still work nicely (which is not the case with typical code generation approaches, e.g., Yacc output).
    • "But the source will take up so much disk space!" With a 120 GB hard disk, who cares if Hello World takes 10 KB? That's a whopping 0.0000077% of your disk space.

    The author also makes a persuasive case about programmer's hyper-conservatism compared to other computer users:

    Why, in the early 21st century, do programmers still insist that their tools have to draw exactly one glyph on the screen for each byte in their source files? No one expects AutoCAD or Microsoft Word to do this; even grizzled old Unix fanatics don't expect to be able to open a relational database with Vi or Emacs. One of the great ironies of the early 21st century is that secretaries can easily put organizational charts or cubicle floor plans in e-mail messages, but the programmers who made that possible can't put class diagrams in their code.
    Something to think about.
    1. Re:You didn't actually read the article, right? by Anonymous Coward · · Score: 1, Insightful

      It is painfully clear to me that you are not a coder. That's why you see the back-and-forth here. It's a coder-vs-programmer issue. The programmers don't care how their source is stored, as long as it appears in their IDE the way they want it. Coders *do* care. You say that the article does not propose that we all start writing our programs in XML. Did you stop to think that the stored format *is* how many of us write our programs? Many coders do not rely on IDEs to create their source. That's why they're against this. Because source is exactly that, SOURCE. It should be readable from any text editor. Why would I want a storage format that needs to be interpreted before I can even look at it?

      And your comment "With a 120 GB hard disk, who cares if Hello World takes 10 KB?" is the typical the-software-dictates-the-hardware answer. Many people don't care what size disk they have. Source SHOULD BE as small as possible. The larger the source gets, the more likely something can go wrong. Here's a very plausible scenario. Imagine writing a 2000-line program where the real source is XML-encapsulated. Now imagine that just one of the XML characters is changed (disk corruption, virus, accident, any reason). At best, that encapsulated data is ignored, which will either break the program or alter it. You won't review all 2000 lines when modifying the program, and even if you did, you probably wouldn't notice one missing line (or one missing part of one line). Then you save the file after making other modifications. When you save it, the broken XML portion is removed, and you now have the source of a broken program. Good luck trying to find the problem to fix it.

      And maybe you're right. Who cares if the Hello World program takes 10 KB? But that's a tiny program which takes about 30 bytes compiled. That's about a 341 times source:binary ratio. By that ratio, the source for the Windows XP cmd.exe file should be about 132 MB. But there's also a performance hit for developers when the source files get larger -- slower open, close, search, and compile times. Not to mention a *lot* more memory required, especially when working with larger projects.

      As for the issue of "...but the programmers who made that possible can't put class diagrams in their code.", my answer would be: because we don't want it.

      You may call people like me hyper-conservatism, but it's people like me who kept your computer running at a decent speed back when 25 MHz was considered fast. You now have 3 GHz systems that don't run apps any faster then the optimized apps ran 10 years ago. Some call it progress. I say imagine how fast our systems could be if programs were actually written well, like they used to be.

      I don't disagree that XML-encapsulation could very well make code more readable from person to person. However, I personally don't think the benefits outweigh the drawbacks.

  17. Subtext by Earlybird · · Score: 4, Insightful
    What's coming isn't languages where you edit XML -- because XML has too much syntactic overhead -- but languages which aren't text based -- languages like Subtext (the screencast demo is essential).

    Languages need to evolve out of the pure text medium. This has been happening as incremental hacks to classic languages through code folding editors and AST-aware, intelligent IDEs like Eclipse, literate programming and Python's doctest module. High-level development tools like Delphi were early adopters of the philosophy that code doesn't need to be visualized as text when it's better to visualize it graphically.

    The next step is to store not text but structure. For example, why shouldn't I be able to comment on -- annotate -- a specific number in a mathematic formula in my code? With current text-based languages this would be a headache:

    double phi = 1 - 1 / (1 + Math.exp(-(cv * /* weight */ 0.3 - range) / sigma));

    Instead, I could just select the value in my editor, click on the annotate key, and enter (in nice WYSIWYG HTML or whatever) my comment there. As a result, the editor will show a tiny icon next to the number, or perhaps in the margin, indicating that there's an annotation.

    And why are formulas like that represented with such a poor syntax? Why can't I easily use proper Greek letters and standard math notations such as dots for multiplication, a horizontal line for divisions/fractions, etc.? Why can't I insert images into the source file which illustrate the concept it implements?

    What I'm talking about isn't just "rich source code", which Donald Knuth's literate programming concept covers to some extent. Languages will experience a revolutionary leap when they start treating language elements as flexible blocks of content as opposed to tokens in an AST. Consider internationalization; instead of looking up a string from a language-specific message table, your source code can include the string in every possible language, hidden away in a single visual representation -- it might look something like:

    showDialog("File not found" [English, Swedish, (8 more languages)]);

    where "English ..." is a link that opens up a nice GUI letting you change the strings in different languages. The logic to select the string to choose at runtime exists in the string "component" itself.

    A common problem in dynamically-typed language is that it's hard to implement optional static typing at the language level. It adds a lot of noisy syntax, and unless you add a lot of syntax, it's hard to solve many ambiguities and special cases. With a rich source format, you can hide away the details, similar to my annotation example.

    Unix geeks typically balk at non-textual files, but I blame it on a fundamental lack of imagination. You can have both! Rich source code can be represented as text -- it's just not convenient to edit it like text. Instead, you add intelligence and convenience to your tools. You don't edit your PNG files with Vi -- you use a tool like GIMP or Photoshop.

    1. Re:Subtext by elhedran · · Score: 2, Insightful

      Instead, I could just select the value in my editor, click on the annotate key, and enter (in nice WYSIWYG HTML or whatever) my comment there. As a result, the editor will show a tiny icon next to the number, or perhaps in the margin, indicating that there's an annotation. ...

      Unix geeks typically balk at non-textual files, but I blame it on a fundamental lack of imagination.

      I can type /* weight */ a lot faster than I can take my hands of the keyboard, find the mouse, move the mouse to where the text appeared on the screen, highlight said text, move the mouse to the tool button for annotate (or contextmenu, whatever), and then click to open another dialog and type 'weight' anyway.

      When you type at 80+wpm anything that avoids you having to touch a mouse is good.

    2. Re:Subtext by Unknown+Lamer · · Score: 2, Insightful

      C-<spc>, [move arrow key to end of block], C-c, C-c.

      Not it's a comment in whatever language you are using. Emacs has done this for ages. No need for a new magic language with new XML based textual formats and new editors written in Java using XSLT and CORBA to format the data for view and send keystrokes to the main app over the network from the keyboard_server...

      --

      HAL 7000, fewer features than the HAL 9000, but just as homicidal!
  18. Re:Damn... by Anonymous Coward · · Score: 1, Insightful
    What we really need is a level of abstration on the keyboard, allowing each programmer to put the keys exactly where they want them!

    Insert picture of programmer popping the key tops off a keyboard and clipping them back on in different places.

  19. Re:Also... think code conversion by Coryoth · · Score: 4, Insightful

    Language conversion. Say you find some open source Perl code that does exactly what you want, but you are a Java shop. So, just run the XML version of the code through an XSLT and voila!

    Lovely theory, but I'd like to see you pull that off in practice. What if I start using some very idiomatic language paradigms in perl, which all make good sense there, but result in, at best a tangled barely intelligible mess of Java, at worst something unconvertible. What this does, in effect, is reduce every language down to a poor quality "lowest common denominator". How do you easily convert a functional language into a procedural one? How do you convert you OO Java code into C? Sure, it can be done, but itf its done in an automated way I'm not sure I would want to be the one responsible for editing and maintaining the results.

    Jedidiah.

  20. Re:Extensible? XML Allows much more by JohnBaleshiski · · Score: 2, Insightful

    I'm not a fan of using the wrong tool for the job. At work we normally use PHP for web applications, but when I see an advantage, I will stray from the "norm" and use Perl.

    XML can be a very good candidate for coding logic. We are starting to do this with several libraries we have developed for manipulating data. It is much easier to get a text document at a major company published than it is to get a DLL published. The DLL is the main engine, controlled by XML documents. We can then create a "custom version" of the library by supplying different XML documents that contain layout and logic. We can write the engine once, then customize it via XML.

  21. Given that my user name is smug_lisp_weenie... by smug_lisp_weenie · · Score: 2, Insightful

    ...I just want to say:

    Congratulations!

    You are now on step 1 on a long and tedious journey to building a poorly-designed lisp dialect!

    Other posters have already made this case well enough that there's not much point in me elaborating! :)

  22. This is only a 20% difference by iamacat · · Score: 4, Insightful

    I don't see why you gave up the benefits of C++ for such a small improvement. One day you might want to display video on the sides of your cubes. With C++, you just pass a VideoCube to renderer.spin(Cube&cube) and it will call approporiate virtual functions to get bitmaps of each of the sides. With C code, you are likely accessing internals of struct Cube directly and can not change it's implementation without re-writting a lot of code.

    Besides, if you really need efficiency, you can write low-level routines in C and still compile them using a C++ compiler. Make Renderer a friend of Cube if you really want to hardcode its internals. Of course, some C++ features like non-virtual method calls have no extra overhead, and some - like inline functions and refrences instead of pointers - can potentially generate faster code.

    OOP can be overdone, but a small degree is useful in any program longer than 2 pages. By contrast, I don't see how coding directly in XML would ever be helpful. If that's an internal representation used by my editor or compiler - well, whatever works for them.

    1. Re:This is only a 20% difference by iamacat · · Score: 2, Insightful

      Oh no. First, you need to put a pointer to a struct of function pointers shared between all instances to have the same space efficiency as C++. That structure should also have a pointer to function table of base class so that you can call functions overridden by yourself without knowing their private names. I assume that each of your structs will have a "super" field of super-struct type in the beginning. To call one of these functions, you would need to do something like:

      Derived *d;
      ((TopBase *)d->functions->draw((DrawBase *)d)(graphicsCtx);

      If draw wants to access fields defined in TopBase, DrawBase and Derived, it will need to cast its first arguments to each of these structs in turn.

      You can implement interfaces by having one "virtual" function that takes a pointer to an interface object and returns a struct with functions of this object for each interface method.

      After a while, you will write macros to encapsulate all these things and will become quite productive. And then one day, you will want to inherit from a struct written by another programmer, who came up with his own virtual functions, inheritance, interfaces and macros.

      Maybe the solution is to write a special version of C compiler with built in support for virtual functions in structs, so that people can use a clean, concise syntax for calling them and structs written by different people interoperate naturally. Oh wait...

    2. Re:This is only a 20% difference by Kesh · · Score: 2, Insightful

      ... and this is why I dropped out of a CS major after the first year. Dear god, just the first paragraph of that makes my head hurt...

      I'd love to write some applications, but C/C++ is like building a home out of Legos. Including the plumbing, electrical and appliances.

  23. Re:One man's view on XML by dvdeug · · Score: 2, Insightful

    My understanding is that there was a big push for XML because of a perceived need for open document formats.

    The advantage of XML is that you can use an off the shelf parser for every language instead of writing a new parser for each language. Let someone else handle the parsing and you handle only what you have to.

    As opposed to computer languages now, where most modern languages (LISP-family excepted) have context-dependent grammars that are incredibly hard to parse correctly and each language has to have a parser written specially for it.

    Binary formats are "closed" only in so far as we do not have access to the source of the program that created them.

    Yeah, I'm sure that if you got the code to Microsoft Word, you could figure out the format just like that.

    Even if you can, then you add another large ball of code to your project, for reading Word files. In the end, you've got a dozen different libraries attached, each one for reading a different format of file.

    JPEG is a binary file format, yet we have open standards and the committee who designed it released open source reference implementations of the decoder and encoder.

    Look at how many file formats the average graphical viewer has to support. Each one has its own library, its own bugs, its own security holes...

    JPEG is an open format and nobody goes around trying to stuff pixels in XML files.

    No; they stuff pixels in PNG files and TIFF files and PNM files and GIF files and a dozen other formats that need to be parsed by completely different parsers.

  24. Redundant syntax in source code is a BAD IDEA by MoxFulder · · Score: 2, Insightful
    The primary benefit of XML is that as a standardized language, standardized parsers can be made available that are reasonably easy to use.
    A lot of comments have suggested that encapsulating source code in XML would make it easier to parse languages in a consistent fashion, and thereby to write better code validators, formatters, style checkers, etc.

    This leads to a logical paradox: if programmers continue to write code in "plain" ascii format, how is it going to acquire the XML markup? Why, someone would have to write a parser, of course!

    This XML encapsulation is a misguided effort to create a standard interface to code parsing. Guess what! A highly effective parser already exists for every single programming language. It's the compiler!

    To encapsulate source code in an XML form that redundantly specifies how it is to be parsed is asking for trouble:

    1. What if the XML markup ever gets out of sync with the plain text source code? Either:
      1. Software for editing/validating/formatting the code WILL catch the problem. If so, that software must include a parser for the ASCII source code, thus rendering the XML useless, OR...
      2. XML-ified software WILL NOT catch the problem. The code might get highlighted incorrectly in the editor or incorrectly validated by the code checker (yikes!)
    2. What if compiler writers get lazy and start relying on the "pre-parsed" source code. Now the programmer might be in the lovely situation of editing plain text code that's marked up INCORRECTLY with *hidden* XML code that's affecting the compilation of the program.
    My point is, don't include redundant information in the fundamental form of your source code, because it will get out of sync somehow. Remember all those wParam variables in 16-bit Windows API? The "w" was supposed to "document" that it's a 16 bit variable. Now it's declared as a 32-bit variable and everyone calls it wParam... if they still code in C. At worst, it's misleading, at best useless and annoying.

    If people want a standard way to decipher language syntax, then compiler writers should write hooks in their compilers to export the parse tree in a standard format. Heck, it could even be an XML format, but this should be treated like an object file (it's derived from the source code rather than the source code itself).

  25. Re:You missed a key point in the article... by Lusa · · Score: 2, Insightful

    I'm not certain I see any real benefits listed, for 2, 3 and 4 this currently exists without using XML. This is because of something very simple... languages have formally defined syntax. Thats so the compiler can do its job without becoming a mind reader to work out what the programmer really meant. I'm not even sure how its possible using XML as a storage mechanism (whilst still editing something that looks like normal source code) will force well defined variable names. That comes down to the discipline of the programmer in question, I could still use i, j, k and l if I wanted to.

    If 4 was ever implemented, you would be welcoming in maybe the slowest programming language on the planet. Besides, drag and drop already exists (VB anyone?) not to mention most IDE's will have templates which provide what you want at a quicker rate and I wouldn't even want to think of how big the dnd pallete would need to be for all the possible language constructs out there.

    If I were to pick one example of where this already exists I'd pick Eclipse, though Visual Studio has similar features. It creates in memory AST's of the source being edited so that most refactoring operations are a breeze (2). This also means it validates the code as its being typed (3). Templates allow dropping in most common language constructs and it can automagically fill in what it thinks are the most appropriate variables for method calls (4).

    So far, besides the first point the rest already exists..

  26. break -- by Anonymous Coward · · Score: 1, Insightful

    after invoking the correct dtd (and finding one of the three people on the planet who can write a complex dtd without fcsking it up b.a.r. or making it pig slow to parse)

    then we can write things like
    <loop_check_top><initialize arguments><assign><argument><variable> i </variable></argument><value><integer>0</integer>< /value></initialize /arguments>
    <evaluate><argument><variable>i</vari able><compari son>lessthan</comparison>
    <integer>3</integer></e valuate>
    <modify><variable>i</variable><operator> <integer>i ncrement</integer></operator</loop_check_top>
    <ex ecute>

    Which is terrifically easier to read than
    for(i=0;i<3;i++){

    and because execute can be rendered in different ways so that the { goes on the next line. That's some powerful stuff.

    And because with our really smart DTD's we can emulate this exotic loop structure in languages that only support checking loops at the end by creating some automatic variables!

    Give me a break.

  27. It has very clear uses by tallbill · · Score: 3, Insightful

    If you have XML you can suck it into a DOM parser and then do node walking. Then you can write the data from the nodes into structures in whatever language you have. And for this reason it makes a great way to feed data from one program to another.

    It is a very inefficient way to have the data for a program while the program is running.

    I agree that XML can be whatever you want it to be, and I agree that it is very over-hyped and the OOPSLA mongers, who make their money trying to confuse people into buying into their solutions, are behind XML in a large way.

    XML is still good for many things.

    But it is very bad for high-performance programming like robotics or video games, or graphics or music. It is a good thing to use to store data, or at startup in a real-time process.

    For web pages having the tags around all the data makes XML formated pages very easy to spider. And for that reason alone it is very useful to use in web pages. But that XML will look just like HTML.

    So don't disregard XML all the way. But please do continue your health skepticism about it.
    The object-tool mongers caused a lot of problems and a lot of grief for many engineering products by selling tools that were designed by amatuers and supposed to work in real-world real-time situations where they just couldn't hack it.

    Were there ever any refunds made for any of these so-called tools? These professors got rich selling their seminars and a lot of very good companies got duped.

  28. Re:One man's view on XML by elhedran · · Score: 3, Insightful

    No; they stuff pixels in PNG files and TIFF files and PNM files and GIF files and a dozen other formats that need to be parsed by completely different parsers.

    You say that like its a bad thing.

    png is good for icons and webpage graphics (unless your target is IE). Its compresses well, is lossless, and has good transparency

    tiff is a good choice for very large, very high color images, such as producing for poster prints

    pnm are an excellent format for doing batch transformations (such as sticking together, rotations, etc. Just see the pnm* tools with any Linux Distro.

    gif is paletted, and compress better than png's for low color images. If you only have 20 or so colors and only a need for a mask (or perhaps would like some animation) gif is your bet. See 'screensavers' on mobile phones.

    In your world, webpages would take much longer to load, poster prints seem faded and image transformation tools would take forever. Oh, and I wouldn't be able to fit a 'screensaver' on my mobile phone. All because you can't be bothered to use one of the many, existing, image transformation tools.

  29. Re:Umm... by canuck57 · · Score: 2, Insightful

    Seriously. Isn't software bloated enough? Why obfuscate things further. Dumbest... idea... ever.

    Couldn't agree more. Leave it to some MS XML pin head to think you need a new language to be extensible.

    The fool should study polymorphism, and a object orientated language like Java or C++. But I suspect that is all is to much for the child's brain.

    Going to be flame bait for this:

    ALL XML IS IS FREE STYLE HTML/SGML and your smoke'in crack if you do not realize it.

    And when I type code I hate typing

    <><><></></></>
    all the freaking time to make my job productive. Or at least I don't think it makes me virile.
  30. could somebody tell me whats wrong with LISP? by Paolomania · · Score: 2, Insightful

    Maybe too much schooling has made me a stodgy young academic, but didn't LISP provide us with extensibility and everything else XML cuold possible offer, in a much cleaner and more elegant syntax?

  31. Indeed. by warrax_666 · · Score: 2, Insightful

    Whenever I see people trying to pull something like this I tend to remind them of one thing (everbody seems to forget this whenever XML is brought up, I dunno why...):

    Semantics matter!

    It's great that you can read the syntax of a language (which is basically what this idea boils down to -- people just have to implement an XML parser instead of a $LANG-parser) without effert, but if you don't understand the semantics of what you're reading it's rather pointless, unless all you want to do trivial tree-based transforms. This applies to XML in general and it applies here. As you pointed out, the semantics of languages are different, and so your tools have to understand all the different languages anyway (or, as you say, reduce them all to some common denominator).
    --
    HAND.
  32. Re:I don't understand by Seahawk · · Score: 2, Insightful

    How on earth is an argument like that "insightful"?

    "Getting milk from the store is more convenient than having your own cow" is the biggest lie ever!

    Lots of farmers gets their milk from cows without a problem.

    But for the topic:
    When I write a binary format that is basicly just a filedump of som c-struct, how compatible is that with c#?

    Sure - I CAN read it - but it takes effort.

    If I wrote the same file in xml, it would be pretty effortless to read it in php, c#, java, VB, you name it.

    And with the binary file i get the added bonus that extending the file WHILE maintaining backwards compability is a bitch.

    Can this be overcome by a smart developer - sure, but it would take effort.

    Extending the xml-file would be pretty simple.

    There are other bad things about xml - why not focus on these, instead of pulling things out your behind?