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

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

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

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

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

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

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

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

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

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

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

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