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?"

45 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 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
  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 lukewarmfusion · · Score: 5, Funny
      No, don't you prefer this:
      <invoke-expr method="myMethod"><evaluate>record</evaluate></inv oke-expr>

      over this:
      someObj.myMethod(record);

      ? I, for one, welcome the obscuring verbosity. It's a challenge. It's exciting. It's job security.
    2. Re:Is this guy serious? by hasdikarlsam · · Score: 5, Informative

      You mean, like Lisp has been capable of for the last thirty years?

      I think you're looking for macros. Proper, Lisp macros, not the weak text-substitution nonsense C comes with. :D

      Ooh, this story is great. Next on, how to reinvent the wheel - in XML!

    3. 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.

    4. Re:Is this guy serious? by Jerf · · Score: 3, Interesting

      Actually, this is a potentially good use of XML.

      Bear with me.

      The primary benefit of XML is that as a standardized language, standardized parsers can be made available that are reasonably easy to use.

      The primary "oversell" of XML is to extend that claim to cover semantics. Human readability is great and should not be underestimated in some uses, but should not be oversold either.

      So let's say you want to write a tool to validate that some Java code conforms to something or other. What's the hardest part of that task, that shouldn't be hard? Parsing the Java code. I mean, it's not like it's impossible for someone skilled enough to even consider writing such a tool in the first place, but it is a legitimate challenge; it's very easy to get 90% correct but that last 10% can be a bitch.

      And let's not even talk about trying to parse Perl.

      Exposing the AST in XML is not a bad idea; it's a perfect match of the two technologies. You still have semantics to deal with, but we're a ways from being able to standardize those.

      Now, as LISP has shown, programming straight to the AST, while it has its advantages, is a historical loser. But that doesn't make exposing it in a standard fashion a Bad Idea. On top of it, you layer a more conventional language... and as strongly as I am defending an XML-exposed AST, I even more strongly believe it would be a stupid, fatal mistake to make that the human-exposed language that one actually programs in. I've worked with a couple of things that only come close (XBL and XUL Templates, where the primary flaw of the latter is that it should be a language and isn't) and a thing that is an XML language (XSLT) and I think it was a grave error on both counts.

      Even better if multiple languages could share one standard or at least semi-standard AST; sharing semantics has proven to be a non-starter I think but there's still hope at the syntax level. (.Net shows that trying to share semantics means you end up with five languages that are just different spellings of the same thing, only without the convenient AST in XML to work with.)

      This isn't a pointless abstraction, but it is something that will probably only be useful on big projects. I say "probably" because if a language with this capability ever got off the ground, there might be interesting things that could be done that we've not even thought of.

    5. Re:Is this guy serious? by Curtman · · Score: 4, Funny

      If the tools are inconvenient to use or not suitable to the problem at hand, they don't get used.

      Tell that to the Internet Explorer development team.

    6. 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.

    7. Re:Is this guy serious? by interiot · · Score: 4, Funny
      In the begining (1954, according to my O'Reilly poster) was Cobol. People moaned and complained.

      Next came Lisp (1958). They had to literally invent garbage collection simply to be able to create the language. In 2005, garbage collection is finally starting to be found in almost every non-embedded language.

      1982 brought us Postscript. It's new! Exciting new syntax. Well, okay, Lisp thought of it first.

      1996 brought the world XML. Exciting new syntax! Again!

    8. Re:Is this guy serious? by Frank+T.+Lofaro+Jr. · · Score: 4, Funny

      And if it fails to help you keep your job, you have yet another XML item to add to your resume. :)

      --
      Just because it CAN be done, doesn't mean it should!
    9. 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
  3. shhhhh by Neil+Blender · · Score: 3, Funny

    Larry Wall might be listening.

  4. Yea, Good Idea by the_mad_poster · · Score: 3, Funny
    Oh, that would be just wonderful. I was just thinking about how I could take my nicely modularized source files and bloat them into 450kb monstrosities without actually adding any value along the way.

    Wait, I have an idea, why don't we all just run this script before we start a new job and then paste bits of the junk output randomly throughout the source files?
    perl -e "print pack 'c*', rand(255) for(1..$ARGV[0]);" 2500
    Dumbest. Idea. Ever.
    --
    Alito: A vote for Alito is a punch in the eye to put that bitch back in her place!
  5. Damn... by ackthpt · · Score: 5, Funny

    They should have put the < and > keys in the middle of the keyboard.

    --

    A feeling of having made the same mistake before: Deja Foobar
  6. Short answer, no by Anonymous Coward · · Score: 4, Funny


    <content="N0!!!!!!!!!!!!!">
    </answer>

    1. Re:Short answer, no by shogun · · Score: 4, Funny

      You left the DTD off, we'll unfortunantly have to ignore your reponse.

    2. Re:Short answer, no by legirons · · Score: 3, Funny

      Think you missed some punctuation...

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <answer type="long" xmlns:h="http://www.w3.org/TR/slashdot/answer">
      <content="![CDATA[N0&exclamation;&exclamation;&exc lamation;&exclamation;&exclamation;&exclamation;&e xclamation;&exclamation;&exclamation;]]" />
      </answer>

  7. 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
  8. 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.
  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. Holy mother of all that is good, NO! by Mirk · · Score: 4, Interesting

    Three and a bit years ago, as a satire on the absurd over-enthusiasm for all things XML that was then taking over the world, I invented a parody language, XMC. Guess what? The over-enthusiasm for XML has continued unabated and now has taken over the world. And so life imitates art.

    Herewith, a sample XMC program:

    <?xml version="1.0" encoding="ISO-8859-1"?> <program language="c" xmlns="http:miketaylor.org.uk/xms/1.0/"> <include type="sysfile">stdio.h</include> <function type="int" name="main"> <params> !-- No parameters --> </params> <statement> <expression> <fncall fnname="printf"> <arguments> <argument> <constant type="int" value="0"/> </argument> </arguments> </fncall> </expression> </statement> <statement> <return> <constant type="int" value="0"/> </return> </statement> </function> </program>

    Exercises for the reader:
    1. What does this do?
    2. Is it easier to read than the corresponding C program?

    --

    --
    What short sigs we have -
    One hundred and twenty chars!
    Too short for haiku.
    1. Re:Holy mother of all that is good, NO! by Piquan · · Score: 4, Funny

      At a guess, it segfaults when printf tries to read its formatting string and gets (on most platforms) a null pointer instead.

    2. Re:Holy mother of all that is good, NO! by Anonymous Coward · · Score: 3, Interesting

      I think just about all the posters on this thread are mostly missing the point. The goal is not to have programmers writing XML. The goal is to provide a "programmer -level" -language-independent way to represent programs in both conventional (brittle) languages like C++, and in extensible languages like Lisp.

      Why would anyone want to do this? Programmer A writes a piece of code that has a confusingly-named identifier, say xglorp. Programmer B, doing maintenance on that code, wants to do a global search and replace on the bad identifier; not a replace of the string-form of that identifier -- not something like %s/xglorp/EventExitStatus/g in vi -- but on all the occurrences of that actual identifier in the code. To do this, your editing tool needs to be able to look at the parse tree; hence you need some cooperation from your compilers + linkers + editing environments, all working together.

      The idea is not to have people writing XML. You would write in your own real language, and your program would be translated into XML, and saved that way. The next programmer asks to have the program represented in his language-de-jour. If his language and your language are semantically similar, this can work. If they're not, it won't work, since you are trying to solve the UNCOL problem (the holy grail for the universal intermediate representation, which does not exist).

  11. 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.

  12. You missed a key point in the article... by malakai · · Score: 3, Informative
    From the article:

    We believe that next-generation programming systems will most likely store source code as XML, rather than as flat text. Programmers will not see or edit XML tags; instead, their editors will render these models to create human-friendly views, just like Web browsers and other WYSIWYG editors. For example, a program stored on disk like this:

    <doc>Only replace below threshold</doc>
    <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>

    would be viewed and edited like this: // Only replace below threshold
    if (record.age > threshold) {
    record.release();
    }

    Crucially, code will not be stored as uninterpreted CDATA within XML documents and programmers will not see (much less type in) XML tags. Such a representation would have all the disadvantages of JSPs, Ant, and other hybrid systems, without bringing any tangible benefits. Instead, XML will represent the program's deep structure. Only time and experimentation will tell whether this turns out to be something like an annotated syntax tree or something more abstract.


    It's not that big of a deal to implement. Just get the major IDE's to play along, all will no doubt retain the ability to persist or convert to ASCII tokens when needed. The benefit comes when your in a very large enterprise project and you want to write some automated code testing or style checking, or even security audits. Being abstracted from the specific languages TOKENS lets you write a relative language neutral code auditor with ease.

    I'd easily use XSL + XPATH to do some major change over using a big ass regex.
    1. Re:You missed a key point in the article... by tomhudson · · Score: 3, Informative
      I'll believe it when I see it (and maybe not even then :-)
      1 Formatting. As mentioned in the article. The days of 4-space vs 8-space tab debates are over. The days of curly-braces-on-the-same-line vs next-line debates are over. You view your source the way you want to, other developers view it the way they want; the underlying XML stays the same.
      You can already do that with a simple script on any source. No nead for xml.
      2 Changing stuff. As mentioned by the parent. If (for example) variable names are well-defined, then the IDE can go and rename them all at will.
      Again, no big deal for a simple script (which is what a lot of code obfuscation scripts do).
      3 Validation. Suddenly, parsing all that code becomes much easier, because we have a well-established XML validation mechanism.
      Just because something parses ok doesn't mean it's valid code ... look at how much stuff parses ok, compiles ok, but doesn't run as expected.
      4 ... Your editor can collapse or expand blocks.
      ... both vi and kate already do this ...
      Your editor only allows you to use declared variable names in assignments.
      Not a good idea for languages that auto-vivify unpredeclared variables ... or languages that allow the creation of new variables and/or new types of variables at runtime, or for anonymous variables (and anon. functions/methods) ... or for dynamically-generated runtime code.

      I doubt I'll be using it any time in the next decade.

    2. Re:You missed a key point in the article... by Brandybuck · · Score: 3, Interesting

      You would never edit the raw XML of your source code...

      Call me an old fart, but why couldn't I edit the raw source code? My PHB can't understand why I don't use MSWord to write C++ code. He can't grok the concept of plain text. "Puh-lane tekst" I keep telling me, but he keeps complaining that he wants my local variables in a different font. Now you come along validating his insanity!

      The days of 4-space vs 8-space tab debates are over.

      Here's a clue: those days were over decades ago. Some people still argue over it, but they're the type of people who argue over nothing. Just ignore them and move on. If you cater to their quirks and foibles you only encourage them. Here's the answer to that debate: it doesn't matter because it's too trivial to bother with.

      Suddenly, parsing all that code becomes much easier, because we have a well-established XML validation mechanism.

      Thank goodness! I don't know how many more years I could have put up with stupid compilers not being able to validate my code.

      Drag an if-then block into your source code. Drag a for loop block into your source code. Your editor can collapse or expand blocks.

      Since when did you need XML for this? Correct me if I'm mistaken, but doesn't Kate/Kdevelop do this already? I understand that many of you use that leprous shit of an editor that comes with Visual Studio. But that's no excuse to eliminate plain text source code. Get a real editor and stop dragging the rest of us down to your level.

      --
      Don't blame me, I didn't vote for either of them!
  13. Haskell is a language for writing languages. by shapr · · Score: 5, Informative
    This is a standard paradigm in the Haskell world. You write a new language that fits the problem domain. These are called Domain Specific Languages
    For example, Simon Peyton-Jones wrote a combinator library to describe financial contracts and used it to describe the collapse of Enron. (With fascinating conclusions!)
    Paul Hudak has written Dance and Haskore. Dance is a language that describes dance choreography, with a handy OpenGL viewer. Haskore is a music scoring language where code looks like:
    > cMajScale = Tempo 2
    > (line [c 4 en [], d 4 en [], e 4 en [], f 4 en [],
    > g 4 en [], a 4 en [], b 4 en [], c 5 en []])
    Languages, spoken or programming, or any other means of expression is most efficient when it fits the problem domain.

    If this sort of thing interests you, Lambda The Ultimate is a good forum to learn more.
    --

    Shae Erisson - ScannedInAvian.com
  14. 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
  15. One man's view on XML by marciot · · Score: 5, Interesting

    I personally do not understand what the entire hype about XML is, or even specifically what problem it is supposed to solve. My understanding is that there was a big push for XML because of a perceived need for open document formats. The idea being that binary formats were proprietary, closed and non-portable.

    If this is the problem XML intends to solve, then I feel it is a miguided effort. Binary formats are "closed" only in so far as we do not have access to the source of the program that created them. Once that source is available, binary file formats are open, portable, and a hell of a lot more space efficient than XML. 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. Hence, JPEG is an open format and nobody goes around trying to stuff pixels in XML files.

    I really think XML is a solution to the wrong problem. The problem is closed source software, not binary files.

    -- Marcio

    1. 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.

  16. 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.

  17. <comment><type="funny"> by ZiZ · · Score: 4, Funny


    <do-in-order type="step">
    <step order="1"><pontificate subject="programming languages"/></step>
    <step order="2"><ellipsis/></step>
    <step order="3"><invoke-slashdot cliche="list-of-steps">profit!</invoke-slashdot></ step>
    </do-in-order>
    <forget-formatting/>
    <welc ome-overlords type="needlessly complicated, obfuscated, and wordy"/>
    </invoke-slashdot>
    </rant>
    <remark type="obligatory-attempt-at-wit">But it could be worthwhile.</remark>
    </type>
    </comment>
    <sig>

    --
    This flies in the face of science.
  18. 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 groomed · · Score: 5, Informative

      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.

      A format which is as flexible and comprehensive as you describe is not convenient to edit period. The problem is that every tool which wants to edit a small part of it needs to understand (or at least be aware of) all of it.

      Want to calculate a line number? Have to parse and render the entire document. Want to generate a diff? Have to parse and render the entire document. Want to translate a string? Have to send the entire document to the translator and wait for it to come back. Want to post a code snippet for discussion? Have to create a new file, paste the code snippet, then upload the file, meaning all discussion gets separated from the code. Unless every browser/mail reader/whatever is changed to understand the format, but this just reiterates the point made above.

      This is not to say that it wouldn't have its uses, but they'd be rather specialized, and you'd probably end up with only 1 or 2 programs which can actually fully understand the format, somewhat similar to the current situation with Flash and Squeak.

      There are very good reasons why we have the functional decomposition we have today. It makes it easier to work with other people.

  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. 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.

  21. Re:Silly article (Silly Post (Silly Reply)) by PylonHead · · Score: 3, Funny

    So let me get this straight:

    You're arguing that programming languages are hard to parse, because, if you don't use any of the tools developed over the last 35 years to parse programming languages, it's hard?

    In a similar vein, you might find that building a set of shelves is hard if you don't use hammers, screwdrivers, and drills, but instead try to embed nails into the wood simply by slamming your head into them repeatedly.

    --
    # (/.);;
    - : float -> float -> float =
  22. Yay for <xml>. by Anonymous Coward · · Score: 5, Funny

    <response language="English">
    <exclamation tone="sarcastic">
    <word partofspeech="adjective" syllables="1">
    <character encoding="ascii">W</character>
    <character encoding="ascii">h</character>
    <character encoding="ascii">a</character>
    <character encoding="ascii">t</character>
    </word>
    <word partofspeech="indefinite article" syllables="1">
    <character encoding="ascii">a</character>
    </word>
    <word partofspeech="adjective" syllables="1" emphasis="true">
    <character encoding="ascii">g</character>
    <character encoding="ascii">r</character>
    <character encoding="ascii">e</character>
    <character encoding="ascii">a</character>
    <character encoding="ascii">t</character>
    </word>
    <word partofspeech="noun" syllables="1">
    <character encoding="ascii">i</character>
    <character encoding="ascii">d</character>
    <character encoding="ascii">e</character>
    <character encoding="ascii">a</character>
    </word>
    <punctuation>
    <character encoding="ascii">!</character>
    </punctuation>
    </exclamation>
    </response>

  23. 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.