On Thursday 23 October 2003 13:44, Stefan Bodewig wrote:
> On Thu, 23 Oct 2003, Jose Alberto Fernandez
>
> <[EMAIL PROTECTED]> wrote:
> >> From: Stefan Bodewig [mailto:[EMAIL PROTECTED]
> >>
> >> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to