commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertburrelldon...@blueyonder.co.uk>
Subject Re: [digester][PROPOSAL] named stacks
Date Mon, 15 Mar 2004 21:51:55 GMT
i've decided that martin's right and that the named stacks should 
follow the usual conventions. i've committed changes so that 
EmptyStackException's are thrown and added an isEmpty method. any more 
feedback on this new API would be appreciated.

- robert

On 8 Mar 2004, at 03:20, Martin Cooper wrote:

> On Mon, 1 Mar 2004, robert burrell donkin wrote:
>
>> On 28 Feb 2004, at 20:06, Martin Cooper wrote:
>>
>>> I can't think of a specific use case for named stacks, but I'm
>>> prepared to
>>> believe that one exists. I certainly appreciate the need for
>>> communicating
>>> between rules, since that's something I've needed before, and I 
>>> guess I
>>> could use named stacks for that, once it's in place.
>>>
>>> A couple of specific comments:
>>>
>>> * I don't see a need to auto-create the stack on get-style operations
>>> (e.g. pop and peek). I would think it would be sufficient to create 
>>> it
>>> only when something is being pushed on to it.
>>
>> yep
>>
>>> * Wouldn't you want to throw an exception if someone tries to pop a
>>> value
>>> off an empty or non-existent stack? You didn't specify the behaviour
>>> below, but I'm assuming that you're currently planning on returning
>>> null
>>> in those circumstances?
>>
>> this is a bit of a moot point, i'd say. i'd prefer to return null but
>> the current behaviour (for the existing stack) is (i think) throwing a
>> exception. my feeling is that the exception is really being used for
>> control flow which (i'd say) is a bit wrong.
>>
>> any particular reason why you'd want an exception to be thrown? (i'd 
>> be
>> willing to persuaded that an exception is better.)
>
> Well, it would seem to me that attempting to pop an item off an empty
> stack is an error in the first place, so an exception seems 
> appropriate.
> Consistency with the default stack also seems like a good thing.
>
> --
> Martin Cooper
>
>
>>
>> - robert
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message