ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Lenz <cml...@gmx.de>
Subject Re: Official (reserved?) namespace of Ant itself???
Date Mon, 20 Oct 2003 10:55:52 GMT
peter reilly wrote:
> On Monday 20 October 2003 10:53, Christopher Lenz wrote:
>>peter reilly wrote:
>>
>>>Note that introspection discovered elements are
>>>in the ant:core namespace. This does make some
>>>things a little difficult to use/explain:
>>>
>>>    <ac:switch value="${foo}">
>>>      <ant:case value="bar">
>>>        <echo message="The value of property foo is bar" />
>>>      </ant:case>
>>>      <ant:case value="baz">
>>>        <echo message="The value of property foo is baz" />
>>>      </ant:case>
>>>      <ant:default>
>>>        <echo message="The value of property foo is not sensible" />
>>>      </ant:default>
>>>    </ac:switch>
>>
>>Not to state the obvious, but this looks awfully wrong. 
> 
> Hence the example...
> 
> The problem which is perferable:
> 
> <ac:if>
>    <equals arg1="a" arg2="${prop}"/>
>    <then>
>       blab ...
>    </then>
>    <else>
>       blab..
>    </else>
> </ac:if>
> 
> or
> <ac:if>
>    <equals arg1="a" arg2="${prop}"/>
>    <ac:then>
>       blab ...
>    </ac:then>
>    <ac:else>
>       blab..
>    </ac:else>
> </ac:if>
> 
> or both?

Hmm, not easy.

Maybe the following rule could be used: if the element defines the *name* of 
a nested element (as in addXXX, addConfiguredXXX and createXXX), the 
namespace of the element should be inherited by the nested elements. If the 
element only defines the interface of the nested element (as in add(XXX)), 
the namespace in which the concrete nested element was declared should be used.

Example 1 wouldn't be possible by the above rule AFAICT.

Example 2 would correspond to a task interface of:

   public class IfTask {
     public void add(Condition c) { ... }
     public TaskContainer createThen() { ... }
     public TaskContainer createElse() { ... }
   }
   [or similar]

Note that I haven't really played with Antlib and namespaces in Ant yet, so 
that may very well be what's currently implemented. ;-)

-chris



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message