On Monday 17 November 2003 15:57, Stefan Bodewig wrote:
> On Fri, 14 Nov 2003, peter reilly <[EMAIL PROTECTED]> wrote:
>
> > 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.

I suppose it depends on how one sees macrodef. Treated as
a simple macro substition:
 
 <macrodef name="show">
    <element name="x"/>
    <sequential>
        <property name="inmacro" value="Set in macro"/>
        <x/>
    </sequential>
 </macrodef>

 <target name="s">
   <show>
    <x>
       <echo>inmacro is '${inmacro}'</echo>
     </x>
   </show>
</target>

the target "s" would become:
<target name="s">
  <sequential>
       <property name="inmacro" value="Set in macro"/>
       <echo>inmacro is '${inmacro}'</echo>
   </sequential>
</target>
And the above will behave the same as the macrodef version.


>
> But there will never be any double expansion, right?  I mean,
>
>       <echo>inmacro is '$${inmacro}'</echo>
>
> would always result in
>
> > s:
> > inmacro is '${inmacro}'

Yes with the current implementation (not with some of my intermediate
implementations...)

Peter


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to