ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick (Gus) Heck" <>
Subject Re: Problems with <import>
Date Mon, 22 Jul 2002 20:55:12 GMT

Jose Alberto Fernandez wrote:
> From: "Nicola Ken Barozzi" <>
> >
> > wrote:
> > > On Fri, 19 Jul 2002 wrote:
> > >
> > The fact is that we need to be able to run *any* task at init.
> > There are two options:
> >
> > 1) make all tasks runnable top-level
> > 2) deprecate using top-level tasks and add an <init> tag
> >
> > I favor 2, also because 1 vas vetoed I guess, it breaks some
> > functionality currently, and makes it possible to add tags between
> > target definitions, which is really confusing IMO, since it implies
> > wrongly that the tasks there will be run /between/ targets, which is not
> > the case.
> >
> So, are variable declarations in Java confusing just because the language
> allows you to declare the variable AFTER it use in a method?

Yes it can be confusing, which is why _I_ think this sort of thing is
bad style... The fact that sun has allowed this merely means that
someday I will run into a file that is written in a haphazard way, and
have to spend a lot of time understanding it. 

That being said, it is less problematic in the case of java classes
because with the exception of the main method there is no implied order
of execution. Even in the case of main it is clearly deliniated where
that begins and ends. Within main (or any other method) the execution
order is the order appearing in the file. 

In an ant file that has top level tasks there IS an implied execution
order, and I feel fairly certain that having elements that don't obey
that order interspersed with elements that do is confusing to the vast
majority of people.

> Is it confusing that you can define static blocks in Java interspersed with
> your method definitions and they are executed in the order they appear?
> Do you know you can do the same with non-static initialization blocks?

Yes, and you don't have to have any newlines in your java file either...
so what?

> Different people organize their Java files differently, the same can apply
> to ANT files. We do not need to impose our views. The important thing
> is to impose a clear set of concepts.

This is true, but I would have been perfectly ok with a more
standardized format in java for some of the items you have mentioned.
Most of the organizations that one finds don't employ the examples you
have given, and I doubt there are any really critical reason for those
to be allowed. I suspect sun didn't want to spend the time checking for
things that most experienced programmers would avoid anyway. Keep the
compile time down and such.

IMHO the liklihood that people will get confused and perhaps frustrated
with ant by interspersing non-ordered targets with ordered tasks is much
greater than the liklihood that people will define static and non static
initializers in the midst of a bunch of methods.

So as I said before, i am for top level tasks with enforced ordering
with targets comming after all initializers if that is possible.


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message