ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Murdoch" <adammurdoch...@yahoo.com>
Subject RE: IntrospectionHelper request
Date Mon, 07 Jan 2002 04:28:32 GMT


> -----Original Message-----
> From: Conor MacNeill [mailto:conor@cortexebusiness.com.au]
> Sent: Monday, 7 January 2002 10:40 AM
> To: Ant Developers List
> Subject: RE: IntrospectionHelper request
> 
> 
> 
> 
> > -----Original Message-----
> > From: Adam Murdoch [mailto:adammurdoch_ml@yahoo.com]
> > Sent: Monday, 7 January 2002 10:31 AM
> > To: Ant Developers List
> > Subject: RE: IntrospectionHelper request
> > 
> > 
> > 
> > 
> > > Where we have numerous patterns for things like
> > > 
> > > addX
> > > createX
> > > addConfiguredX
> > > setX
> > > 
> > > we could have probably gotten away with just
> > > 
> > > addX
> > > setX
> > > 
> > > or even just
> > > 
> > > setX 
> > > 
> > 
> > Good idea (for Ant 2, at least).  The current distinction between 
> > attributes and elements on the task interface is kinda artifical. 
> 
> Adam,
> 
> Have you considered the difference between createX and addX. This 
> is not about attribute/elements. It is about who knows how to 
> create an object. If we just have setX, then the implication is 
> that all nested element objects are created by the core and not 
> by the task. Are you suggesting that the ability for a task to 
> create its nested elements should be removed?
> 

Not removed - though maybe less necessary.  The main uses I've seen for a create method are:

* To create an adaptor, or some other polymorphic type.  This is definitely something that
is better done outside the task.

* To create nested Path elements, because Path doesn't have a no-args constructor.  Same for
Mapper and a few others.

* For implicit file sets.

There are other other uses, of course, but these seem to be the main ones.  And none of them
terribly compelling justifications.  It might be worth considering doing away with the create
method for Ant 2.

The problem with a create method is that it gets in the way of the container doing stuff like
type substitution or reference resolution.  The create method is responsible for both creation
and setting the element value, so the container (or the user) can't override the creation.

Perhaps we change the semantics of the create method in Ant 2, so that it is only responsible
for creation.  The container would not always call the create method  - it would call it instead
of calling the no-args constructor of the nested type.  The container would always call the
set method, with a fully configured object, regardless of where the object came from.


Adam


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


Mime
View raw message