> From: peter reilly [mailto:[EMAIL PROTECTED]
>
> On Thursday 23 October 2003 13:44, Stefan Bodewig wrote:
> > On Thu, 23 Oct 2003, Jose Alberto Fernandez
> >
>
> 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
>
Notice that following this path (not making locals visible) means
that <macrodef> defined tasks will behave differently than java written
tasks, more over it means that macrodef is not really the same as having
the code in place. Ex:
<macrodef name="m">
<echo>${a}</echo>
</macrodef>
<property name="a" value="G"/>
<target name="x">
<local name="a" value="L"/>
<echo>${a}</echo>
</target>
<target name="y">
<local name="a" value="L"/>
<m/>
</target>
Targets x and y are suppose to do the same thing, at least
that is what a "macro" is supposed to do. But here the behavior
changes in unexpected ways depending on whether "a" is local or global.
If I had written <m/> in java, I would see the local value, but since
I wrote it using <macrodef/> that is not the same. So I can forget
about writing new tasks by just composing existing tasks toguether. :-(
> <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]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]