Front page | perl.perl5.porters |
Postings from July 2004
Re: more 5.9 sort tests
Thread Previous
|
Thread Next
From:
david nicol
Date:
July 21, 2004 14:46
Subject:
Re: more 5.9 sort tests
Message ID:
1090446331.1010.14.camel@plaza.davidnicol.com
On Wed, 2004-07-21 at 07:37, Rafael Garcia-Suarez wrote:
> david nicol wrote:
> > @@ -577,6 +577,13 @@
> > @input = sort {$b <=> $a} @input;
> > ok "@input", "G H I D E F A B C", 'stable $b <=> $a in place sort';
> >
> > +# test that optimized {$b cmp $a} remains stable (new in 5.9)
> > +# without overloading
> > +@b = sort { $b <=> $a } @input = qw/5first 6first 5second 6second/;
>
> I assume you meant "cmp" instead of "<=>" here ?
no not at all. We have been calling the optimization "{$b cmp $a}"
even though it works with both alpha-compare and the spaceship operator.
Switching to the spaceship in the comment would be clearer.
I was not aware that the overloaded tests were already in there when I
went to add the native-overloaded ones using "not-really-numbers."
Overloaded values are treated a little bit different than native SVs
so the non-overloaded test does test a combination that is not being
otherwise tested. I cannot imagine a scenario where the oveloaded tests
would pass and
sort { $b <=> $a } @input = qw/5first 6first 5second 6second/
would fail.
Yes I can -- I have an active imagination -- a misguided fool makes sort
functioning dependent on the elements being magical. These tests would
then fail.
--
david nicol
"People used to be able to read my thoughts, but
it doesn't appear to work any more. Should I eat less cheese?"
-- Elizabeth Woods
Thread Previous
|
Thread Next