Hacker News new | ask | show | jobs
by oblio 264 days ago
Stuff like HCL and Ansible YAML makes me want to require mandatory training in Ant contrib tasks for developers creating them:

https://ant-contrib.sourceforge.net/tasks/tasks/if.html

  <if>
    <equals arg1="${foo}" arg2="bar" />
      <then>
      <echo message="The value of property foo is 'bar'" />
    </then>
    <elseif>
      <equals arg1="${foo}" arg2="foo" />
      <then>
        <echo message="The value of property foo is 'foo'" />
      </then>
    </elseif>
    <else>
      <echo message="The value of property foo is not 'foo' or 'bar'" />
    </else>
</if>

https://ant-contrib.sourceforge.net/tasks/tasks/for.html

  <for param="file">
    <path>
      <fileset dir="${test.dir}/mains" includes="*.cpp"/>
    </path>
    <sequential>
      <propertyregex override="yes"
        property="program"  input="@{file}"
        regexp=".*/([^\.]\*)\.cpp" replace="\1"/>
      <mkdir dir="${obj.dir}/${program}"/>
      <mkdir dir="${build.bin.dir}"/>
      <cc link="executable" objdir="${obj.dir}/${program}"
        outfile="${build.bin.dir}/${program}">
        <compiler refid="compiler.options"/>
        <fileset file="@{file}"/>
        <linker refid="linker-libs"/>
      </cc>
    </sequential>
  </for>
Yes, programming with them was as fun as you're imagining.
1 comments

That looks so terrible, but they could have been so easily transformed into an S-expression language similar to Lisp:

    (if (equals foo "bar")
      (then (echo "The value of property foo is 'bar'"))
      (elseif (equals foo "foo")
        (then (echo "The value of property foo is 'bar'")))
      (else (echo "The value of property foo is not 'foo' or 'bar'")))
That’s not a Lisp-like language I particularly like, but it’s not flat-out insane like Ant appears to be.

Advocates for the inappropriate use of XML (basically, anywhere it was used as anything other than a markup language) have lot to answer for.