[Gambas-user] Feature request: Giving _compare() an optional user data argument

Tobias Boege taboege at ...626...
Mon May 19 18:12:05 CEST 2014


On Mon, 19 May 2014, Beno?t Minisini wrote:
> Le 19/05/2014 17:42, Tobias Boege a ?crit :
> >>I don't understand that: if the sort field is a parameter of the sort,
> >>then you can store it inside a static variable just during the sort.
> >>
> >
> >Hmm... that's an idea, indeed! Because we can ensure that no parallel sorts
> >mess up the static variable.
> >
> >Too bad that this is a good solution. We were already excited about this
> >potential new feature :-)
> >
> >Regards,
> >Tobi
> >
> 
> OK, but that potential new feature would have slowed down the sort: calling
> a _compare method with two fixed arguments is faster that calling a _compare
> method with one more optional argument.
> 

Right... Having two differently implemented versions of Object[].Sort() (one
which behaves efficiently when not given an optional argument and one which
passes that argument) is, if not an insane interface, at least nothing that
belongs to the gb component.

For our purposes, maybe a small component gb.multisort may suffice which
enhances Object[] by the necessary logic and we would require users to
provide a _compare2() then which could take the additional argument. No
big deal.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list