You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Jose Alberto Fernandez <ja...@cellectivity.com> on 2002/12/02 19:33:16 UTC

RE: [PATCH] Adding Dynamic elements for the n'th time

I have some problems with this implementation because it
it does not follow the real general rules of ANT subelements,
in other words it only covers some common special case.

Not covering the whole mechanism and just using it for half
of the way a feature can be used will just break things in the future.

Let me explain myself, the following segment of ANT:

	<javac ....>
	  <src ...>
	    <aaa.../>
	  </src>
	  <classpath ...>
	    <bbb.../>
	  </classpath>
	</javac>

The names "src" and "classpath" for elements in this segment of XML does not
describe the TYPE of the element but its USAGE by the task. It is the definition
of the task (by the type of the parameter) the one that decides how to read
the content of the element to fit the type of the parameter. 

Any implementation of polymorthism that does not take this into account will 
never do things right. What makes things confusing is that in many cases
we use the name on a TYPE to refer to its USAGE, but they do not mean the same.
That only works in tasks that ony need one and only one instance of each type.

Jose Alberto

> -----Original Message-----
> From: Magesh Umasankar [mailto:umagesh@apache.org]
> 
> ----- Original Message ----- 
> From: "Stefan Bodewig" <bo...@apache.org>
> 
> 
> > On Wed, 27 Nov 2002, Magesh Umasankar <um...@apache.org> wrote:
> > 
> > >> I think I remember it.  A problem arises when you have two
> > >> different nested elements (element names) that both 
> accept the same
> > >> class.  Say you have <mypath> that is derived from Path, 
> what would
> > >> it be used for in
> > >> 
> > >> <javac ...>
> > >>   <mypath .../>
> > >> </javac>
> > >> 
> > >> src, classpath, sourcepath, bootclasspath and extdirs would be
> > >> possible.  Has this been the reason for your choice Conor?  How
> > >> would your patch deal with it Magesh?
> > > 
> > > If you have addMyPath(MyPath) that would be called;
> > > Else
> > > If you have addPath(Path), that would be called.
> > 
> > But I have addSrc(Path) and addClasspath(Path) - which would be
> > called?
> 
> With the patch I submitted, neither!  
> 
> In the above case, you would have to have
> addSrc(Src) and addClasspath(Classpath) assuming both 
> Src and Classpath both extend from Path.  Of course,
> the element that is being added may be a derivative
> of Src or Classpath also.
> 
> This, I think is a reasonable constraint if you plan
> to be doing different things (obviously) in addSrc and
> addClasspath.  If you do not plan to have differeing code
> in these two methods, then all you need is addPath(Path)
> 
> > Stefan
> 
> Cheers,
> Magesh
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
> 
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>