Today, I turned into Superman. After reading the XML::Twig tutorial, I am now officially bulletproof. After looking at so many XML documents and not knowing where to begin with parsing these in an intuitive way I am now ready to conquer the world.

And I just cannot escape the idea of completely de-obfuscating Perl. And the way to do that is to write Perl programs as an XML document validated against a Perl parser serving as a DTD or Schema.

I can just see the clean, crisp non-scary-looking code now:

<assign name="%students" package='A::B'> <record key="sally" val="Johnson High"> <record key="billy" val="Cedar Brook High"> </assign>

But the amazing thing beyond the readability would the tractability: we could do all sorts of program transformations because the language would be completely regular, completely treelike, and with the gnarliness inherent in XML::Twig completely stackable, reversable, duplicatable, comparable and transformable in ANY WAY you can imagine manipulating a tree.

I mean, think about it: its not the syntax of a language that matters so much as it's semantics right? The only important thing about syntax is that it should be readable, easily parseable and easily generated from other computer programs. I know some of you are going to miss all those cute cryptic little symbols, they were a wonderful shorthand. But look at what we will gain. We will gain the simplicity of lisp in syntax. Each simple expression will be clearly bracketed, but in this case, not with parenthesis, but with a container XML tag whose entire semantics can be looked up in the Perl manual.

This is the future. This is what the 21st century has been screaming for. And XML::Twig has just the arsenal of tools to make my dreams reality.

The only thing is I cannot think of a nifty marketing name for this savior of the world of programming:

  1. PerlXML
  2. XML::Twig::Perl
  3. Langauge::Perl::XML::Twig
  4. GenericPerl
  5. TransformablePerl
  6. PlayDoh-Perl --- that's it!!!!!!! completely malleable.... but how to get the word XML in there so it shows up in search engines?? hmmm.. But what's cool is "Playdoh" almost sounds like "Plato" which means I am harkening back to the roots of man's search for meaning and self-expression. Man! It just gets better and better.

But don't let my fanaticism scare you off. Normal people like XML::Twig as well.

And don't take this post to seriously. I mean it in half-jest but all seriousness. The tone is arrogant but it's a flippant, teasing arrogance. But I am serious about developing this metaperl.

Replies are listed 'Best First'.
Re: PlaydohPerl: our Perl 6 Programs in XML::Twig
by mirod (Canon) on Aug 15, 2001 at 11:48 UTC

    OK, so despite the fact that it would open a huge market for XML::Twig ;--) here is why I think it is a bad idea:

    What you are describing is essentially what Perl 6 aims at, except you want to do it at the wrong level. It makes more sense to have a neutral layer _under_ the language level. So Perl, Python, Ruby, or whatever your favorite language is, can be compiled into the same bytecode. You could get this bytecode and serialize it as XML, and there you are, you've got a Perl/Python/Ruby-independant represention of your code. Then you can go about doing whatever XML transformation you want. But this way you don't force your pet programming paradigm unto unsuspecting programmers, but rather you let them use their favorite language.

    Leon Brocard said this at TPC: "we only write the compiler once but we use te language a lot". Hence it pays to put some complexity in the compiler to save us time when using it. Forcing people to type angle brackets in order to simplify the parsing of the language is false lazyness. $i++ might look harder to parse than <assign var="i" val="$i+1"/> (the funny thing being that it is actually just as hard to parse). Some people still won't talk to me after they had to use an SGML language I once wrote.

    BTW, where do you stop? After an article about XML::Twig on XML.com I got an email that read like this:

    twiggy your ::twig machine should have one method that takes one argument and + that argument should be an xml string. the twig machine can parse instructions from the argument and move fro +m there. the beauty of xml, xml schemas, xslt etc. is that they are essentially + xml. your function calls are nasty looking to me, but xml looks friendly. wouldn't it be "nice" to simply pass xml to your ::twig machine. there is a need for that type of engine; just lose the nasy syntax.

    So really you should forget about that ugly looking XML::Twig stuff and use something like XSLT, which is really what the guy was looking for (and won't find in XML::Twig, nor in Perl!).

    There is a reason why we are not all using the same computer language: (repeat after me) we are all individuals! . Let it stay that way: keep XML for the data and whatever programming language you fancy using for the code.

      Hello

      I believe $i++ would've been translated to something like:

      <assign> <var>i</var> <value> <Math::Add> <value>i</value> <value>1</value> </Math::Add> </value> </assign>
      We might as well do assembly.

      Aziz,,,

Re: PlaydohPerl: our Perl 6 Programs in XML::Twig
by japhy (Canon) on Aug 15, 2001 at 04:52 UTC
    Nice idea. I'm not sure I'm into dulling Perl down (which I'm afraid this is), though.

    metaperl seems to like my posts... ;)

    _____________________________________________________
    Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
    s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Re: PlaydohPerl: our Perl 6 Programs in XML::Twig
by blakem (Monsignor) on Aug 15, 2001 at 14:17 UTC
    A similiar conversation broke out at Perl as XML. You might want to check it out.

    -Blake

Re: PlaydohPerl: our Perl 6 Programs in XML::Twig
by trantor (Chaplain) on Aug 15, 2001 at 16:59 UTC

    princepawn wrote:

    <assign name="%students" package='A::B'> <record key="sally" val="Johnson High"> <record key="billy" val="Cedar Brook High"> </assign>

    Now, this could make circular references very funny to write :-)

    -- TMTOWTDI