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: Macrodef attributes and Local revisited again
Date Thu, 27 Nov 2003 14:19:58 GMT
On Thu, 2003-11-27 at 13:50, Steve Cohen wrote:
> Peter - 
> >>but if macrodef properties are to be implemented as textual substitution
> >>and not as local properties, the two issues can be separated.
> 
> Did you mean to say "but if macrodef ATTRIBUTES are to be implemented as textual substitution
and not as local properties ..."

Yes. I meant macrodef attributes... (I keep getting that
wrong).

Peter

> 
> Or are you talking about properties defined within the execution of a "call" to a macrodef?
> 
> -----Original Message-----
> From:	Peter reilly [mailto:peter.reilly@corvil.com]
> Sent:	Thu 11/27/2003 7:08 AM
> To:	dev@ant.apache.org
> Cc:	
> Subject:	Macrodef attributes and Local revisited again
> Yesterday I said that macrodef attributes should be implemented as
> properties and not as textual substitution.
> 
> On overnight reflection, I have changed by mind.
> 
> MacroDef has been using textual substitution in the ant beta
> builds without much problems (*.. well not quite see below).
> The only issue is the notation used is the same as for properties.
> 
> The proposed new notation is @{x} where x is the attribute.
> 
> I have implemented the new notation and added the following:
> 
>  * the escape sequence @@{x} is used to allow @{x} to be
>    placed in the text without substitution of x. - this
>    corresponds to the $${x} escape sequence for properties.
>  * the macro replacement is now done on the default values for
>    the attributes - this allows Jan's use case to work:
> 
>   <target name="jan">
>     <macrodef name="dep">
>       <attribute name="root"/>
>       <attribute name="file" default="@{root}.dep"/>
>       <sequential>
>         <script language="javascript"> <![CDATA[
>             // attribute expansion from macrodef (script can´t reach the
>             //   values)
>             root     = "@{root}";
>             file     = "@{file}";
>             importClass(java.lang.System);
>             System.out.println(
>                "root is " + root + " and file is " + file);
>                                          ]]>
>         </script>
>       </sequential>
>     </macrodef>
>     
>     <dep root="foo"/>
>   </target>
> 
> This prints out
> jan:
>    [script] root is foo and file is foo.dep
> 
> The order of the attributes is important - 
>     <macrodef name="dep">
>       <attribute name="file" default="@{root}.dep"/>
>       <attribute name="root"/>
> will set file to @{root}.dep.
> 
> 
> A problem encountered in using macrodef for any not trivial macros
> is the need to isolate the use of properties.
> For this I have proposed using the local property patch, but if
> macrodef properties are to be implemented as textual substitution
> and not as local properties, the two issues can be separated.
> 
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 


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


Mime
View raw message