On Thu, 2003-11-27 at 13:50, Steve Cohen wrote: > Peter - > >>but if macrodef properties are to be implemented as textual substitution > >>and not as local properties, the two issues can be separated. > > Did you mean to say "but if macrodef ATTRIBUTES are to be implemented as > textual substitution and not as local properties ..."
Yes. I meant macrodef attributes... (I keep getting that wrong). Peter > > Or are you talking about properties defined within the execution of a "call" > to a macrodef? > > -----Original Message----- > From: Peter reilly [mailto:[EMAIL PROTECTED] > Sent: Thu 11/27/2003 7:08 AM > To: [EMAIL PROTECTED] > Cc: > Subject: Macrodef attributes and Local revisited again > Yesterday I said that macrodef attributes should be implemented as > properties and not as textual substitution. > > On overnight reflection, I have changed by mind. > > MacroDef has been using textual substitution in the ant beta > builds without much problems (*.. well not quite see below). > The only issue is the notation used is the same as for properties. > > The proposed new notation is @{x} where x is the attribute. > > I have implemented the new notation and added the following: > > * the escape sequence @@{x} is used to allow @{x} to be > placed in the text without substitution of x. - this > corresponds to the $${x} escape sequence for properties. > * the macro replacement is now done on the default values for > the attributes - this allows Jan's use case to work: > > <target name="jan"> > <macrodef name="dep"> > <attribute name="root"/> > <attribute name="file" default="@{root}.dep"/> > <sequential> > <script language="javascript"> <![CDATA[ > // attribute expansion from macrodef (script can´t reach the > // values) > root = "@{root}"; > file = "@{file}"; > importClass(java.lang.System); > System.out.println( > "root is " + root + " and file is " + file); > ]]> > </script> > </sequential> > </macrodef> > > <dep root="foo"/> > </target> > > This prints out > jan: > [script] root is foo and file is foo.dep > > The order of the attributes is important - > <macrodef name="dep"> > <attribute name="file" default="@{root}.dep"/> > <attribute name="root"/> > will set file to @{root}.dep. > > > A problem encountered in using macrodef for any not trivial macros > is the need to isolate the use of properties. > For this I have proposed using the local property patch, but if > macrodef properties are to be implemented as textual substitution > and not as local properties, the two issues can be separated. > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]