ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <>
Subject RE: Configure->Template->Build
Date Tue, 05 Jun 2001 12:44:51 GMT
> From: Peter Donald []
> At 11:56 AM 6/5/01 +0200, Stefan Bodewig wrote:
> >But I don't suggest that, as I don't think you need the
> template stuff
> >here at all, i.e. you can achieve the effect of the templating
> >mechanism with projectref as it has been described and Ant2 features.
> err ... preojectref as has been described is dynamic templating (as is
> antcall/ant tasks). The only difference is that this is done
> dynamically at
> runtime rather than statically.

Peter, parameterized software modules have existed in programming languages
since I guess Algol-66. And that is the analogy I used for <projectref>.
Templating, I associate more with Macro expansion. The basic difference
being that a template provides (in general) no syntax nor semantic checking.
Until you expand the template, in general, you cannot know whether the
result is a well formed thing or not.

As a parameterized module, <projectref> does not suffer from that. Since the
referenced project needs to be a valid <project> it can be verified
syntactically, semantically and in most cases it can be executed on its own.
You cannot do that with templates except for very few, and I would say
un-interesting, cases.

> >Let's take the <xsl:apply-templates select="/project/java-compile"/>.
> >What do we have here? Given its position on the javac task I guess
> >this expands to a patternset (maybe more than one, but then
> we'll have
> >set union in Ant2).  Wouldn't <patternset
> ref="" />
> >achieve the same?

Look at this template, can the system verify that every expansion will
generate a syntactically correct ANT file? I do not think it can. Even with
input that may seem valid you can produce bad syntax (due to the
interactions of different xsl:templates, for example). You do not get that
kind of issues with <projectref> you can verify the validity of the referred
project on its own, and given valid parameters to the <projectref>, which
you can validate, you know the total is valid.

This is a much more modular approach.

Jose Alberto

View raw message