ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <jalbe...@cellectivity.com>
Subject RE: local properties
Date Tue, 11 Jan 2005 11:18:06 GMT
> From: Peter Reilly [mailto:peterreilly@apache.org] 
> 
> Jose Alberto Fernandez wrote:
> 
> >As per other approaches to local properties, unless we go 
> and define a 
> >real semantic for them (like any other well design 
> programming language 
> >out there) I see they creating more problems than solutions, in 
> >particular in our BC constrained world.
> >  
> >
> I do not think that the problems are too bad (but I would say that!).
> 
> I would like to have the thread-local property 
> implementation, however there was a lot of discussions about syntax.
> 

How about haing the two, and see which one works better? As I said
before <let/> is a very small change to <macrodef/> with no other
dependencies.

> As the main use case for local properties is <macrodef> we 
> could just implement them for macrodefs, and if necessary 
> extend them later to be the free style properties.
> 
> So the syntax would be:
> <macrodef name="show_length">
>   <attribute name="filename">
>   <local-property name="local-prop"/>
>   <sequential>
>      <length file="@{filename}" property="${local-prop}"/>
>      <echo>The length of file '@{filename}' is ${local-prop}</echo>
>   </sequential>
> </macrodef>
> 

In your example above, are you sure you mean 'property="${local-prop}"'
and not 'property="local-prop"'?

We could write this with let as:

 <macrodef name="show_length">
   <attribute name="filename">
   <let name="local-prop"/>
   <sequential>
      <length file="@{filename}" property="@{local-prop}"/>
      <echo>The length of file '@{filename}' is ${@{local-prop}}</echo>
   </sequential>
 </macrodef>

And in this case the scope of "@{local-prop}" is well defined as 
the body of "show-length".

> 
> We could implement this as a trial in ant cvs and pull it if 
> there are 
> too many issues.
> 
> Peter

Wouldn't mind having the two, and see what works best. :-)

Jose Alberto


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


Mime
View raw message