ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <ddevie...@gmail.com>
Subject Re: EasyAnt <use>/<extends> vs <import>
Date Thu, 06 Nov 2008 15:29:07 GMT
On Thu, Nov 6, 2008 at 4:42 AM, Jean-Louis BOUDART
<jeanlouis.boudart@gmail.com> wrote:
> I'm not sure that adding an as-attribute make sense for <extends>.
> In our POC you can "import" with <use> mode the same file with different
> prefix. exemple :
> <project name="Abstract-Module">
> ...
> </project>
>
> <project name="Concret-Module1">
>   <use file="Abstract-Module" as "AbstractModuleConcret1"/>
> ...
> </project>
>
> <project name="Concret-Module2">
>   <use file="Abstract-Module" as "AbstractModuleConcret2"/>
> ...
> </project>
>
> <project name="genericBuild">
> <extends file="Concret-Module1"/>
> <extends file="Concret-Module2"/>
> </project>

What I've argued before is that the 'as' attribute used by a build
should only be visible to that build. Any other build that uses it
(English meaning of use :) should not be aware of this attribute. This
way both Concrete-Model1 and 2 can use the same as, and it's
genericBuild that's then forced to use two different 'as' attributes
for them to be able to distinguish them.

It's analogs to Java's inheritance, where a derived class can only
refer explicitly to its direct parent's methods, and not any of its
ancestors (like in C++). In other words, you can only bypass the
normal virtual dispatch of method if it's a method of your parent.

There's no reason for genericBuild to directly reference
Abstract-Module. Abstract-Module basically became "part-of"
Concret-Module1 and 2, and is invisible to genericBuild, unless
genericBuild also directly import/includes it.

Failing to do this, you couldn't safely refactor Concrete-Module1 and
2, without possibly breaking genericBuild.

Ah, it looks to me that I'm again failing to get my view across. Since
I'm no longer actively using Ant like I used to, I'll take a step back
and stop arguing the above points, which are probably incompatible
with the (simplistic?) way Ant deals with import and target addressing
(by simple prefixing).

>   - <use> is like a "Rich" <import> that support namespace and that allow
>   you to import many time the same build script with different namespace.

And I thought use was like an include ;) i.e. less than import, while
it's actually more. --DD

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


Mime
View raw message