ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 23942] - Addition of a local property
Date Thu, 21 Oct 2004 16:36:26 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=23942>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=23942

Addition of a local property





------- Additional Comments From peterreilly@apache.org  2004-10-21 16:36 -------
The localscope patch uses dynamic scoping (like lisp) and not static scoping 
(like C) so the result of calling 
 <B/>
 <echo message="${fooA}"/>

is whatever A is set fooA to. fooA is a global property - it has not
been shaddowed by a local property.
Another example is:

  <target name="j">
    <macrodef name="A">
      <sequential>
        <property name="fooA" value="splatto"/>
        <property name="fooB" value="splatto"/>
      </sequential>
    </macrodef>

    <macrodef name="B">
      <sequential>
        <localpropertyscope>
          <localproperty name="fooB" value="XB"/>
          <A/>
        </localpropertyscope>
      </sequential>
    </macrodef>
    
    <B/>
    <echo message="fooA is ${fooA}"/>
    <echo message="fooB is ${fooB}"/>
  </target>

Which will generate:
fooA is splatto
fooB is ${fooB}

the use of fooB in macroA will find the local property decalared
in macroB and attempt to set it (as properties can only be
set once, this will not succeed), and not create a global property fooB.

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


Mime
View raw message