You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Stefan Bodewig <bo...@apache.org> on 2002/11/08 13:32:25 UTC

TaskContainer and nested data-types

Hi,

a technical question, for a change 8-)

If you look into ProjectHelperImpl, you'll see

        public void startElement(String name, AttributeList attrs) throws SAXParseException {
            if (task instanceof TaskContainer) {
                // task can contain other tasks - no other nested elements possible
                new TaskHandler(helperImpl, this, (TaskContainer) task,
                    wrapper, target).init(name, attrs);

the intention seems to be that TaskContainers are not allowed to hold
data-types.  Now try this build file snippet

    <sequential>
      <path id="path">
        <pathelement location="loc1" />
      </path>
    </sequential>

it will work.  The reason is that ProjectHelperImpl inserts a
UnknownElement for <path> and this one replaces itself with the
data-type at runtime.

If you now replace <sequential> with a TaskContainer of your own,
things start to get messy.

    <mycontainer>
      <path id="path">
        <pathelement location="loc1" />
      </path>
    </mycontainer>

will not work in CVS HEAD at all - because <mycontainer> will become
an UnknownElement itself and the handleChildren code in there doesn't
allow any non-tasks to slip through.

To make things worse, in 1.5.1 it will depend on where you place the
<taskdef> for mycontainer.  If you put it at the top-level in front of
the target containing the snippet above, it will work.  If you place
the taskdef after the target (or inside a target), it will fail.

Before I go and make things consistent, I thought I'd ask you what the
correct behavior would be 8-)

Is 1.5.1 wrong in that it should never allow the construct above to
pass?  If so, the sequential case must not pass either.  Be aware that
changing this may cause some build files to break.

Should data-types be allowed inside TaskContainer?  If so,
UnknownElement needs to get fixed.

Stefan

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


Re: TaskContainer and nested data-types

Posted by Stephane Bailliez <sb...@apache.org>.
----- Original Message -----
From: "Stefan Bodewig" <bo...@apache.org>


> OK.  Here we have a point where the behavior depends on <taskdef>
> placement in 1.5(.1), so either solution (allow data-types inside of
> TaskContainers or don't) would break backwards compatibilty at some
> point.
>
> I'd just have a hard time assuming that anybody would rely on that
> behavior 8-)

Rely with consciousness maybe no. Rely with coincidence maybe yes.

I believe it was like that, because as a style, it has been widely accepted
to put data types outside containers and at the very top of the build file.
Correct ?

Maybe putting data types inside containers will make it look like more a
script which has suscited reactions in the past similar to 'vad retro
satanas', but I don't think that it would make sense to force to define data
types outside the containers if the scope is restricted to the
container....mmm...I wonder how many times I will be able to say container
in a sentence.

Note that I'm not sure of the implication at this time. What do you think ?






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


Re: TaskContainer and nested data-types

Posted by Stefan Bodewig <bo...@apache.org>.
On Fri, 8 Nov 2002, Stephane Bailliez <sb...@apache.org> wrote:

> Recent history shows that we cannot fix something that is possibly
> wrong even though it is are plain
> incorrect/invalid/counterintituive.

OK.  Here we have a point where the behavior depends on <taskdef>
placement in 1.5(.1), so either solution (allow data-types inside of
TaskContainers or don't) would break backwards compatibilty at some
point.

I'd just have a hard time assuming that anybody would rely on that
behavior 8-)

Stefan

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


Re: TaskContainer and nested data-types

Posted by Stephane Bailliez <sb...@apache.org>.
----- Original Message -----
From: "Stephane Bailliez" <sb...@apache.org>

> I agree we can spend our time vetoing and see them flying around but this
is
> the way I see things. I'd rather let people move on. I'm just pointing out
> that raising 'backward compatibility' flag only when it suits is no good.

Read 'this is not the way'. Sorry.




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


Re: TaskContainer and nested data-types

Posted by Costin Manolache <cm...@yahoo.com>.
Stephane Bailliez wrote:


>> > I cannot see any reason why they could not. Except enforcing data types
>> > definition outside for style.
>>
>> +1.
> 
> 
> For what is your +1 here ?
> I was understanding in your previous mail that you wanted data types to be
> possible in the container. Is that correct or should I take fresh air and
> reread your mail ?

It is correct. I would like the distinction between data types and 
tasks to be removed.



> [...]
>> If a majority of ant committers don't feel it's a good idea or worth
>> the pain - then it shouldn't be done.
> 
> It's not the problem.
> I agree we can spend our time vetoing and see them flying around but this
> is the way I see things. I'd rather let people move on. I'm just pointing
> out that raising 'backward compatibility' flag only when it suits is no
> good.

"Backward compatibility" is one important issue to consider - but not
the only one. In this case - I don't think anyone would be affected.
For javac default debugging - I think the benefits of changing the
default justifies the backward incompatibility.

In all cases - a PROPOSAL is the best way to move forward. 
Not sure how the 'veto' is related with this discussion - a proposal
is not a code change, so a vote against is not a veto.


 
> I would like you to explain me how you could possibly take the
> responsability of enforcing data types 'outside' the container knowing
> that it would break build files and at the same time not agreeing to
> change the javac debug flag back to normal ?
> ok, this is a bad example for you since you agree on both sides but I
> think you get the idea. :)

I don't get the idea, sorry.

My point is that for any change that is important enough ( and breaking
backward compat is important, as well as changing the build.xml 
semantics ) it is best to have a formal proposal and a majority vote first.
It's not a waste of time.

Costin



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


Re: TaskContainer and nested data-types

Posted by Stephane Bailliez <sb...@apache.org>.
You should see a reply from a 'Phileas Fog' via gmane as well. Damn outlook.

"Costin Manolache" <cm...@yahoo.com> wrote in message
news:aqh39m$esc$1@main.gmane.org...

> > I cannot see any reason why they could not. Except enforcing data types
> > definition outside for style.
>
> +1.


For what is your +1 here ?
I was understanding in your previous mail that you wanted data types to be
possible in the container. Is that correct or should I take fresh air and
reread your mail ?

[...]
> If a majority of ant committers don't feel it's a good idea or worth
> the pain - then it shouldn't be done.

It's not the problem.
I agree we can spend our time vetoing and see them flying around but this is
the way I see things. I'd rather let people move on. I'm just pointing out
that raising 'backward compatibility' flag only when it suits is no good.

I would like you to explain me how you could possibly take the
responsability of enforcing data types 'outside' the container knowing that
it would break build files and at the same time not agreeing to change the
javac debug flag back to normal ?
ok, this is a bad example for you since you agree on both sides but I think
you get the idea. :)





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


Re: TaskContainer and nested data-types

Posted by Costin Manolache <cm...@yahoo.com>.
Stephane Bailliez wrote:

> ----- Original Message -----
> From: "Stefan Bodewig" <bo...@apache.org>
> 
> [...]
>> Should data-types be allowed inside TaskContainer?
> 
> I cannot see any reason why they could not. Except enforcing data types
> definition outside for style.

+1.


>> If so, UnknownElement needs to get fixed.
> 
> Houston, we have a problem.
> 
> Recent history shows that we cannot fix something that is possibly wrong
> even though it is are plain incorrect/invalid/counterintituive. Which
> means that if someone is shooting in his foot right now she must continue
> and we must give them unlimited ammos to fulfill her action for the sake
> of backward compatibility. Amen.

I don't agree with this.

History shows that backward compatibility is extremely important, and 
any change should take that into consideration. But we _can_ fix or
change anything. 

A majority vote can decide what happens - make a proposal, add enough
arguments - and if a majority of ant committers believe it's worth 
it - then it'll be done.

Reminder: a code change can be vetoed, and if backward compatibility is
broken I may be the first to veto ( unless I'm making the commit :-)
But if a proposal for a change is voted and gets majority vote - and
the commit just implements the group decision - I don't think a veto
can be valid ( unless it provides a different/better implementation 
for what the community has decided ).

In other words - if Stefan makes this change and committs - anyone can
veto. If a proposal is made and a majority decides this is the best
for ant - than a veto can only propose a better implementation for
what was decided.

If a majority of ant committers don't feel it's a good idea or worth
the pain - then it shouldn't be done.


Costin

> 
> I don't think that myself, and I think nothing is black nor white, what is
> wrong should be fixed to avoid further problems in the future, you'd
> better catch it now than 6 months later. But this is a typical example.
> 
> I know, I'm a PITA :)




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


Re: TaskContainer and nested data-types

Posted by Stephane Bailliez <sb...@apache.org>.
----- Original Message -----
From: "Stefan Bodewig" <bo...@apache.org>

[...]
> Should data-types be allowed inside TaskContainer?

I cannot see any reason why they could not. Except enforcing data types
definition outside for style.
Do you ?

> If so, UnknownElement needs to get fixed.

Houston, we have a problem.

Recent history shows that we cannot fix something that is possibly wrong
even though it is are plain incorrect/invalid/counterintituive. Which means
that if someone is shooting in his foot right now she must continue and we
must give them unlimited ammos to fulfill her action for the sake of
backward compatibility. Amen.

I don't think that myself, and I think nothing is black nor white, what is
wrong should be fixed to avoid further problems in the future, you'd better
catch it now than 6 months later. But this is a typical example.

I know, I'm a PITA :)




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


Re: TaskContainer and nested data-types

Posted by Costin Manolache <cm...@yahoo.com>.
What I tried to do in embed ( and seems to work - at least for gump test ) 
is move as much logic as possible out of ProjectHelper.

I think making things consistent would help a lot - and IMO that 
means creating UnknownElement for all elements, including those on top
level.

I would also vote to remove the restriction on 'only tasks inside 
TaskContainer' - even if it may be counterintuitive as name. I think
the right direction is to treat task and data types the same. We 
already did that for the top level.

If a TaskContainer ever wants to execute a non-task - it'll get
an exception or it'll be a no-op.


Costin


Stefan Bodewig wrote:

> Hi,
> 
> a technical question, for a change 8-)
> 
> If you look into ProjectHelperImpl, you'll see
> 
>         public void startElement(String name, AttributeList attrs) throws
>         SAXParseException {
>             if (task instanceof TaskContainer) {
>                 // task can contain other tasks - no other nested elements
>                 possible new TaskHandler(helperImpl, this, (TaskContainer)
>                 task,
>                     wrapper, target).init(name, attrs);
> 
> the intention seems to be that TaskContainers are not allowed to hold
> data-types.  Now try this build file snippet
> 
>     <sequential>
>       <path id="path">
>         <pathelement location="loc1" />
>       </path>
>     </sequential>
> 
> it will work.  The reason is that ProjectHelperImpl inserts a
> UnknownElement for <path> and this one replaces itself with the
> data-type at runtime.
> 
> If you now replace <sequential> with a TaskContainer of your own,
> things start to get messy.
> 
>     <mycontainer>
>       <path id="path">
>         <pathelement location="loc1" />
>       </path>
>     </mycontainer>
> 
> will not work in CVS HEAD at all - because <mycontainer> will become
> an UnknownElement itself and the handleChildren code in there doesn't
> allow any non-tasks to slip through.
> 
> To make things worse, in 1.5.1 it will depend on where you place the
> <taskdef> for mycontainer.  If you put it at the top-level in front of
> the target containing the snippet above, it will work.  If you place
> the taskdef after the target (or inside a target), it will fail.
> 
> Before I go and make things consistent, I thought I'd ask you what the
> correct behavior would be 8-)
> 
> Is 1.5.1 wrong in that it should never allow the construct above to
> pass?  If so, the sequential case must not pass either.  Be aware that
> changing this may cause some build files to break.
> 
> Should data-types be allowed inside TaskContainer?  If so,
> UnknownElement needs to get fixed.
> 
> Stefan




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


Re: TaskContainer and nested data-types

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message ----- 
From: "Stefan Bodewig" <bo...@apache.org>
To: <an...@jakarta.apache.org>
Sent: Friday, November 08, 2002 4:32 AM
Subject: TaskContainer and nested data-types

> Before I go and make things consistent, I thought I'd ask you what the
> correct behavior would be 8-)

I dont know. 


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