I have an even more interesting for you, try running this one:
<?xml version="1.0"?>
<project name="fake-target" default="fake" basedir=".">
<taskdef name="target" classname="org.apache.tools.ant.taskdefs.Echo" />
<target name="fake">
<target message="What? A target inside another?" />
</target>
</project>
You will not even get a warning!
The matter of fact is that we do not have reserved words in the language.
Trying to assume
priviledges just by name is just getting ourselves into trouble.
Looking at this example and what it tells us, I start to be puzzled by the
proposal of
having an <init> block instead of loose top level tasks (but I dislike the
"init" name).
In the case above, it would make clear when things (elements) should be
interpreted as part of
the <project> structure and when should be interpreted as tasks or datatypes.
Alternatively, you could say, "the heck with structure", and just make even
<target>
be implemented as a "priviledge" task. That way its redefinition just means one
wants
to use a different implementation of it. I know this was vetoed before, but as
the ASF
process indicates, things can always be revisited (not that I am advocating for
that).
Jose Alberto
----- Original Message -----
From: "Stefan Bodewig" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 23, 2001 2:33 PM
Subject: Re: [Ant2] Tasks as siblings of <target>
> On 19 Oct 2001, Stefan Bodewig <[EMAIL PROTECTED]> wrote:
>
> > (4) Keep it the way it is in Ant 1.4
>
> if we'd really use hardcoded names, the implementation should be
> smarter than the one of 1.x 8-):
>
> [EMAIL PROTECTED] /tmp >cat > silly.xml
> <project default="foo">
> <taskdef name="property" classname="org.apache.tools.ant.taskdefs.Echo" />
> <property message="So what?" />
> <target name="foo" />
> </project>
>
> [EMAIL PROTECTED] /tmp >ant -f silly.xml
> Buildfile: silly.xml
> Trying to override old definition of task property
> [property] So what?
>
> foo:
>
> BUILD SUCCESSFUL
>
> Stefan
>