ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: Target or macrodef?
Date Wed, 25 Aug 2004 13:54:33 GMT
At 08:48 AM 8/25/2004 +0200, you wrote:
> >
> > > hi,
> > > this would be great !
> > >
> > > recently, i had exactly that problem (setting a "temp" property in a
> > > <macrodef/>) ... i had to use <antcall/> as work-around :(
> > >
> >
> > Well, <antcall> is just totally unnecessary.  Just use the value of
> > the macrodef
> > attributes as a property.  Obviously it becomes a property that will
> > live
> > throughout the app, but it is usually so unique that that you'd never
> > define or
> > generate another property by the same name.  If the value won't be
> > unique, you
> > can chain multiple macrodef attribute values together to make a truly
> > unique
> > property.  For more information, see...
> >
> > http://ant.apache.org/faq.html#propertyvalue-as-name-for-property
>
>i disagree - i guess there are of course reasons for using <antcall/>
>and i guess my example above is one of them.
>
>while ur "solution"  or better called "work-around" may work too i would
>not use it cause THIS is an ugly hack - thats the way unmaintainable
>code is produced! what u r talking about is "generating" property names
>and this does definitively makes the code harder to read ... at least
>IMHO ... what does a generated property name tell about its use or the
>coders intention ?  nothing!
>i guess the best and obious solution would be to allow some kind of
>variable scoping in ant.

I see your point and I already referred to it as a "hack", but I disagree 
that it is unmaintainable.  Since the property is meant to be used 
temporarily, the confusion will only be in one place; the macrodef 
itself.  I would suggest simply writing a comment saying what exactly is 
being done.  Most macrodefs aren't tremendously large so a little 
documentation should suffice to ease or resolve any confusion that might 
otherwise occur.  The bloat and messiness of <antcall> far outweighs any 
disadvantages of the current "hack" available in macrodef.  Like I said 
before, a local property might be nice, but it won't bother me if it never 
makes it into Ant as the "hack" is all I need.

Jake


>thx
>regards,
>seb
>
><snip/>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org


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


Mime
View raw message