----- Original Message -----
From: "Gary Gregory" <[EMAIL PROTECTED]>
> Here is a proposal that I think addresses all issues but I am not sure why
> changing reverse() to return something instead of void is not backwards
> compatible (granted you need to recompile). Are we saying that we want
> binary compatibility. It seems ok to ask folks to recompile.
With big projects I believe asking users to recompile is OK. However for low
level commons components, I believe binary compatability is required.

[lang] is already widely dispersed and used, and hopefully this will
increase. This means that these users are tied to 2.0. A binary incompatable
2.1 (or 3.0) creates real problems if [lang] has been used by two different
other OSS projects and they decide to upgrade to 2.1 at different times.

[lang] (and [collections] and other commons components) are the low-level
OSS components, so we have extra responsibilities.

> 1) reverse does not change but is deprecated, in favor of:
> 2) new methods reverseShallow (as opposed to "deep") are just like reverse
> and it returns its arg.
> 3) do not add reverseAsCopy until someone asks for it.
While this would work, it feels unecessary. By returning void from the
reverse method it is very clear that the reverse is occuring in place. This
is less clear with a returned object array.

reverseCopy() can be achieved by
 array = ArrayUtils.clone(array);
 ArrayUtils.reverse(array);
I'm not feeling the requirement to have reverseCopy() ATM

Stephen

> Thoughts?
>
> Gary
>
> > -----Original Message-----
> > From: Stephen Colebourne [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, October 08, 2003 13:20
> > To: Jakarta Commons Developers List
> > Subject: Re: [lang] ArrayUtils.reverse
> >
> > I would agree that reverse() should probably return the array, however
> > this
> > is a nasty backwards compatable change, seems harmless but actually
messes
> > up anyone where two OSS projects require different versions of lang. (We
> > made some incompatble changes in 2.0, but I'm aiming to avoid these
> > entirely
> > now in such a low level library as lang) So I'm -1.
> >
> > reverseCopy() sounds fine, however I would question how much of a need
it
> > meets. We must be very challenging of new methods in lang to avoid too
> > much
> > bloat, without blocking everything. Its a fine line.
> >
> > Stephen
> >
> > ----- Original Message -----
> > From: "Gary Gregory" <[EMAIL PROTECTED]>
> > > I think I like it BUT the issue you raise is an orthogonal one.
> > >
> > > (1) A method that returns void cannot be used in an expression,
period.
> > > Client can always ignore the return value and it does not cost the app
> > > anything.
> > >
> > > (2) Whether or not the array is twiddled in-place or not is a separate
> > issue
> > > and we are talking about a new API. So let's deal with both
separately.
> > For
> > > a new API I see the following possibilities:
> > >
> > > (2.1.1) reverseCopy(type array[])
> > >    Sorts with reverse.
> > >
> > > (2.1.1) reverseAsCopy(type array[])
> > >    Sorts with reverse, a little better.
> > >
> > > (2.2) copyReverse(type array[])
> > > Makes copying the most prominent verb, not quite right IMHO.
> > >
> > > (2.3) reverse(type array[], boolean copyFirst)
> > >       Barf.
> > >
> > > Gary
> > >
> > > > -----Original Message-----
> > > > From: __matthewHawthorne [mailto:[EMAIL PROTECTED]
> > > > Sent: Wednesday, October 08, 2003 12:09
> > > > To: Jakarta Commons Developers List
> > > > Subject: Re: [lang] ArrayUtils.reverse
> > > >
> > > > I think it's a good idea, but I like method that returns void also,
> > > > because it may save memory by modifying the input array.
> > > >
> > > > Maybe your suggested method should be renamed to:
> > > >
> > > > Object[] copyReverse(final Object[] array)
> > > >
> > > > and be modified to not operate on the argument, but instead create a
> > > > copy of it and return the reverse of the copy.
> > > >
> > > > What do you think?
> > > >
> > > >
> > > >
> > > >
> > > > Gary Gregory wrote:
> > > >
> > > > > Hello,
> > > > >
> > > > > How about returning the argument instead of void for these APIs
such
> > > > that
> > > > > they can be used in expressions?
> > > > >
> > > > > Now ArrayUtils:
> > > > >
> > > > > public static void reverse(final Object[] array) {
> > > > >
> > > > > Proposal:
> > > > >
> > > > > public static Object[] reverse(final Object[] array) {
> > > > >
> > > > >
> > > > > I ran into this with the Object[] version of the API but this
> > applies
> > to
> > > > all
> > > > > other ArrayUtils.reverse APIs.
> > > > >
> > > > > This change should backwards compatible with a recompile of client
> > code.
> > > > >
> > > > > Thanks,
> > > > > Gary
> > > > >
> > > >
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to