ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack J. Woehr" <...@purematrix.com>
Subject AntCallIfElse
Date Tue, 04 Sep 2001 05:05:40 GMT
Hello Ant developers --

I'm recently new to Ant but using it with great success. I've been browsing
the code and some of the documents about the Ant team's plans for Ant 2.

I'm looking at http://jakarta.apache.org/ant/ant2/requested-features.txt

      [DISC] procedural versus purely declarative
      -------------------------------------------

      * Simple flow control (if-then-else, for)

        [REJECTED - vetoes by Conor MacNeill, Glenn McAllister, Peter Donald
                    and Stefan Bodewig]

The reasons to keep Ant essentially declarative are obvious. With approval I note
that you also rejected a motion to make Ant 'purely declarative', a shibboleth
refuted already in logic programming.

There is precedent, however, for a "declarative kind of proceduralism" in other
declarative languages, for example, the m4 ifelse() macro.

It looks as if one could employ the style of coding worked out by Stefan Bodewig in
org/apache/tools/ant/taskdefs/condition to create a class CallTargetsIfElse based
on CallTarget. This would allow syntax like:

    <antcallifelse>
        <equal>
            <arg1="${some.prop}"/>
            <arg2="${some.prop}"/>
        </equal>
        <if target="true_target">
            <param="${a}"/>
            <param="${b}"/>
        </if>
        <else target="false_target">
                <param="${c}"/>
                <param="${b}"/>
        </else>
    </antcallifelse>

This seems a little clearer than what I do now (is this actually
correct?) :

    <target name="true_target" if="${a}">
        ...
    </target>

    <target name="false_target" unless="${a}">
        ...
    </target>

    <target name="switch">
            <antcall target="true_target"/>
            <antcall target="false_target"/>
    </target>

Would the coding of an AntCallIfElse task be, in the light of your
prior vote cited above, a welcome or unwelcome contribution?

Thanx, Jax

--
Jack J. Woehr     # "I never worry that all hell will break loose.
Senior Consultant #  I worry that half hell will break loose, which
Purematrix, Inc.  #  is much harder to detect." - George Carlin




Mime
View raw message