ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: MacroDef: use attribute inside another attributes default cla use
Date Tue, 21 Oct 2003 14:31:08 GMT
> From: peter reilly [mailto:peter.reilly@corvil.com]
> 
> This won't work as the default attribute gets processed by ant before
> macrodef sees it.
> for example:
> <property name="foo" value="global foo"/>
> <macrodef name="macro">
>    <attribute name="foo"/>
>    <attribute name="bar" default="${foo}"/>
>    <sequential>
>      <echo>bar is ${bar}</echo>
>    </sequential>
> </macrodef>
> <macro foo="macro's foo"/>
> 
> generates
> foo:
> bar is global foo

And this time I think I'm right Peter when I say *this* is what I argued
vehemently against. In the fruitless argument on ant-dev we had, I pointed
out that you are overloading the meaning of ${name} in <macrodef>, which is
perfectly apparent in the above example. And this is why I wanted to
introduce a special notation for referring to the <macrodef> attributes,
implicitly making them 'local properties' as you've introduced in your
patch. ${name} would still evaluate *as usual*, dynamically changing the
actual implementation of the <macrodef> *at the point of definition*, while
(@name) (or some other notation) would have evaluated *at runtime* to the
'local property'.

I'm pretty sure I'm still missing a subtlety about <macrodef> and its
expansion of properties, and what I said above could be false, but the traps
and pitfalls hiding in <macrodef> are a recipe for too much confusion as it
stands IMHO. --DD

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


Mime
View raw message