On Tuesday 28 October 2003 17:39, Dominique Devienne wrote:
> > From: peter reilly [mailto:[EMAIL PROTECTED]
> >
> > It appears that the attributes as local properties
> > patch
> >
> > http://issues.apache.org/bugzilla/show_bug.cgi?id=23942
> >
> > causes macrodef to behave in the way you expect.
> >
> > A cut-down version shows this.
> >
> > <project>
>
> Let me add:
>
> <property name="a" value="AAA" />
> <property name="b" value="BBB" />
>
> > <macrodef name="inner">
> > <attribute name="a"/>
> > <attribute name="b"/>
> > <sequential>
> > <echo> name="a" value="${a}"</echo>
> > <echo> name="b" value="${b}"</echo>
> > </sequential>
> > </macrodef>
> >
> > <macrodef name="outer">
> > <attribute name="work"/>
> > <attribute name="play"/>
> >
> > <element name="precompile" optional="true"/>
> > <element name="additional" optional="true"/>
> >
> > <sequential>
> > <precompile/>
> > <additional/>
> > </sequential>
> > </macrodef>
> >
> > <target name="test.outer">
> > <outer work="this is work" play="this is play">
> > <precompile>
> > <inner a="${work}" b="${play}" />
> > </precompile>
> > </outer>
> > </target>
> > </project>
> >
> >
> > Ant 1.6 currently outputs:
> > test.outer:
> > [echo] name="a" value="${work}"
> > [echo] name="b" value="${play}"
> >
> > With the patch
> > this gets output:
> >
> > test.outer:
> > [echo] name="a" value="this is work"
> > [echo] name="b" value="this is play"
> >
> > Peter
>
> What's the output now, with the addition?
>
> I assume currently property 'a' and 'b' are simply ignored and the output
> you show above Peter doesn't change w/ or w/out the patch. This behavior
> has a name, and it's *variable hiding* (properties here in fact), and it's
> not a recommended behavior.
Something like *variable hiding* would be needed to support local
properties - unless one used another notation was used for local
properties (Costin suggested "local:" as a prefix for local properties).
This is Stefan's argument - local properties should not
have dynamic extent. This makes the *variable hiding* much worse. However
this does occur currently with <antcall target="t"><param a="AAA"/></antcall>.
Peter
>
> As a user of Ant pre-<macrodef>, I would expect the output to be (with my
> addition):
>
> test.outer:
> [echo] name="a" value="AAA"
> [echo] name="b" value="BBB"
>
> And without it:
> [echo] name="a" value="${a}"
> [echo] name="b" value="${b}"
>
> Of course, one would then need a new notation to de-reference the
> attributes of the <macrodef>... Exactly what was rejected in the first
> place.
>
> Adding this new notation for <macrodef> attributes disambiguates regular
> property de-references, from the macro's attributes, once and for all.
>
> As far as using the local patch, yes, it does make sense as you show above,
> but it still doesn't solve the point I've been trying to make from the get
> go, and that apparently everybody else simply dismisses. --dD
>
> ---------------------------------------------------------------------
> 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]