ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter reilly <peter.rei...@corvil.com>
Subject Re: Vote: <local> for 1.6
Date Thu, 23 Oct 2003 13:01:46 GMT
On Thursday 23 October 2003 13:44, Stefan Bodewig wrote:
> On Thu, 23 Oct 2003, Jose Alberto Fernandez
>
> <jalberto@cellectivity.com> wrote:
> >> From: Stefan Bodewig [mailto:bodewig@apache.org]
> >>
> >> If you have several nested <ant>s, you'd have to check each level
> >> for a <local> that was in place shadowing your global value.
> >
> > But this is no more or less shadowing than me making one of the
> > <ant> calls passing a <param> with the value of the local.
>
> Except that <param> is explicit and doesn't happen by accident.
>
> > I think it is a mistake that <local> if local is not visible across
> > <ant>, if that were the case then it should not be visible across
> > <macrodef> either.

This is my point. The <local> should be visible for both or for none.

>
> You have a compelling example here
>
> >  <macrodef name="m">
> >   <echo>${p}</echo>
> >   <if>
> >     <equals arg1="${p}" arg2="my local p"/>
> >     <then>
> >   	<antcall target="tm"/>
> >     </then>
> >   </if>
> >  </macrodef>
> >
> >  <target name="x">
> >    <local name="p" value="my local p">
> >      <m/>
> >    </local>
> >  </target>
> >
> >  <target name="tm">
> >   <echo>${p}</echo>
> >  </target>
> >
> >  <property name="p" value="my global p"/>
> >
> >  [echo] my local p
> >  [echo] my global p
>
> and I currently don't have an answer for this.
If <m/> and <antcall> do not make local p visible,
then one simply gets:

x:
     [echo] my global p

  <macrodef name="m">
    <sequential>
      <echo>${p}</echo>
      <antcontrib:if>
        <equals arg1="${p}" arg2="my local p"/>
        <then>
          <antcall target="tm"/>
        </then>
      </antcontrib:if>
    </sequential>
  </macrodef>

  <target name="x">
    <local name="p" value="my local p"/>
    <m/>
  </target>

  <target name="tm">
   <echo>${p}</echo>
  </target>

  <property name="p" value="my global p"/>

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


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


Mime
View raw message