You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by James Todd <jw...@pacbell.net> on 2000/11/28 10:34:14 UTC

macro expansion (was: Re: Proposed Revolution: AntEater (a proposal for Ant Core 2.0))


Peter Donald wrote:

<snip/>

> But Ant needs that anyway if you want runtime interpretation which is I
> think what has been decided. I don't think we should go to the extent of
> thread safe implementations protected by monitors/synchronized blocks but
> we do need to dynamically interpret the original form if we are to do
> things like
>
> <mytask myattr="${myVar}"/>
>
> So it may be ugly but it is a necessary ugly unless we decide to stop
> runtime interpretation again (or worse have mixed interpreation).

whilst playing around with jDom and converting a largish java.util.Property
based app config framework (complete with macro's and the like) to an
xml form (in order to express lists) i merged in the macro expansion syntax
found in ant with a twist ... that being that the value of the macro was
evaluated as a reference to a named node within the tree within memory
using "." delimiters to represent parent->child transitions. i expanded on
this theme a bit by allowing for leading dots to navigate the tree from a
relative perspective (an inside out perspective). further, the expansion
evaluated recursively.

once completed i was quite happy with the results. i was able to break
up largish config files into smaller more "constant" like data files which
resided on a central "resource" server to be "inlined" via an http get and
referenced accordingly.

bigger picture i might've mapped to some x[ref | link | id] or what not but
that stuff looked to be a bit fuzzy to me at the time.

the reason i state this is cuz some don't like the ugliness of the macro'ness

but to me it is a huge enabler if used diligently. once i forced the
behaviour
of the expansion to just be the value(s) of another node within the tree all
blemishes disappeared for me.

if the "rules for macro expansion" leaned more in this direction i'd be a
happy camper ... unless i'm missing something here which was the purpose
of the posting in the first place :) please shine a light!

<snip/>

- james