ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: macrodef - do attributes as properties or substitutions
Date Mon, 17 Nov 2003 15:57:15 GMT
On Fri, 14 Nov 2003, peter reilly <peter.reilly@corvil.com> wrote:
> On Friday 14 November 2003 14:07, Stefan Bodewig wrote:
>> On Fri, 14 Nov 2003, peter reilly <peter.reilly@corvil.com> wrote:

>> > I do not like using a different notation for attributes.
>>
>> unless they are a different thing than properties, if I understand
>> you correctly.
> Not quite, I mean that if they are differnet from properties, a
> different notation should be used, but I do not like using a
> different notation in principle.

Message understaood, thanks.

> An example:
> <target name="s">
>   <macrodef name="show">
>    <element name="x"/>
>    <sequential>
>        <property name="inmacro" value="Set in macro"/>
>        <x/>
>    </sequential>
>   </macrodef>
> 
>   <show>
>     <x>
>       <echo>inmacro is '${inmacro}'</echo>
>     </x>
>   </show>
> </target>
> This shows:
> 
> s:
> inmacro is 'Set in macro'
> 
> It would be very difficult to stop this.

So we must ask outselves whether this is good or bad for us.

If the property inmacro has been defined before the macro invocation,
the task inside the macro will be a noop - the user gets the expected
behavior.

If it has not been set, well, this might come unexpected.

But there will never be any double expansion, right?  I mean, 

      <echo>inmacro is '$${inmacro}'</echo>

would always result in 

> s:
> inmacro is '${inmacro}'

Stefan

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


Mime
View raw message