Daniel Pittman wrote:
> One of us must be.  Perhaps it was my sarcasm, perhaps I completely
> misunderstood your point.  To help clear this up:
> 
> There is no difference in the information conveyed using a child tag or
> an attribute of a tag.
> 
> The only difference between the two, in SGML, is that attributes have
> less rules applied.  They can, and often are, more informal.

And that the attribute form is a hell of a lot more compact and easier to
eyeball.  Sometimes humans have to read and write this crap, ya know?

As insane as it is that anyone would pick XML as a human data format.  I'm
looking at YOU Ant!

Here's the "simple" Ant Buildfile from their documentation.
http://ant.apache.org/manual/using.html#example

<project name="MyProject" default="dist" basedir=".">
    <description>
        simple example build file
    </description>
  <!-- set global properties for this build -->
  <property name="src" location="src"/>
  <property name="build" location="build"/>
  <property name="dist"  location="dist"/>

  <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>
  </target>

  <target name="compile" depends="init"
        description="compile the source " >
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}"/>
  </target>

  <target name="dist" depends="compile"
        description="generate the distribution" >
    <!-- Create the distribution directory -->
    <mkdir dir="${dist}/lib"/>

    <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
    <jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>
  </target>

  <target name="clean"
        description="clean up" >
    <!-- Delete the ${build} and ${dist} directory trees -->
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
  </target>
</project>

Oh GOD!  I'm supposed to read that?!  And write it?!  Willingly?!  It makes
make look positively beautiful.

Here's the same thing in YAML.

name:           MyProject
default:        dist
basedir:        .
description:    simple example build file

# set global properties for this build
properties:
    src:
        location:   src/
    build:
        location:   build/
    dist:
        location:   dist/

targets:
    init:
        actions:
            - tstamp
            - mkdir: { dir: '${build}' }

    compile:
        depends:    init
        descripton: compile the source
        actions:
            # Compile the java code from ${src} into ${build}
            - javac: { srcdir: "${src}", destdir: "${build}" }

    dist:
        depends:        compile
        description:    generate the distribution
        actions:
            # Create the distribution directory
            - mkdir:  { dir: '${dist}/lib/' }

            # Put everything in ${build} into MyProject-${DSTAMP}.jar
            - jar:
                jarfile: '${dist}/lib/MyProject-${DSTAMP}.jar'
                basedir: '${build}'

    clean:
        description:    clean up
        actions:
            # Delete the ${build} and ${dist} directory trees
            delete:
                - { dir: '${build}' }
                - { dir: '${dist}'  }

Note the almost complete lack of scaffolding code (text that's conveying only
syntactical structure).  Just not having to worry about balancing tags alone
makes my brain leap in joy!  Different things look different, it's not a
homogenous mud of angle brackets.  Comments stand out.  Lists stand out.
Key/value pairs stand out and can be sensibly lined up.  Why?  Because it
doesn't try to pretend the entire universe can be rammed into just a tree
structure.  The real world uses lists and pairs.

And that's just a rote translation.  If it started out with the
scalar/list/hash mindset of YAML instead of <phrase><word
type=article>the</word><word type=adjective>nested</word><word
type=noun>tree</word><word type=foul>crap</word><punctuation>,</punctuation> I
could probably come out with something even better.


-- 
Stabbing you in the face so you don't have to.

Reply via email to