Re: Hoplites: Watch for "each"

2003-11-01 Thread Michael G Schwern
On Fri, Oct 31, 2003 at 05:01:32PM -0600, Andy Lester wrote:
> Anything that uses the C operator is a prime candidate for 
> bugginess.  Please keep an eye out for them as you do your testing.  
> Any function that contains C oughta be heavily checked.
> 
> Ditto anything that uses C or C without a sort.

Ummm... why?


-- 
Michael G Schwern[EMAIL PROTECTED]  http://www.pobox.com/~schwern/


Re: Hoplites: Watch for "each"

2003-11-01 Thread Andy Lester
Anything that uses the C operator is a prime candidate for
bugginess.  Please keep an eye out for them as you do your testing.
Any function that contains C oughta be heavily checked.
Ditto anything that uses C or C without a sort.
Elaborating:  Code that uses C, C or C may have 
worked in the past because the order of elements would be the same 
between runs.  For instance, you have one hash, and then another hash 
with the same keys, and the code relies on those keys being in the same 
order between the hashes.   This reliance might be explicit or 
accidental.  Now, with 5.8.1 randomizing hashes, that code may break.

Also, in .t files, it'd be a good thing to not rely on each/keys/values 
when determining the order of tests, because subsequent test runs might 
not be in the same order.  For example:

my %tests = ( test1 => 'foo', test2 => 'bar', etc );

while ( my($key,$val) = each %tests ) {
# do a test
}
The order in which these tests are done will be different between runs 
of the code...

xoa

--
Andy Lester
[EMAIL PROTECTED], AIM:petdance
http://petdance.com/ http://use.perl.org/~petdance/