id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	lang	patch	platform
397	Double negatives need inverting in most uses of Parrot_str_not_equal	Util		"History:[[BR]]
Due to its {{{strcmp(3)}}} parentage, Parrot_str_equal (prior to r36336) returned true when not equal, and false when equal. In r36336 and r36338, the return value for Parrot_str_equal was inverted, to match the intuitive meaning of the function's name. The new function Parrot_str_not_equal was created as a drop-in replacement for the old API of Parrot_str_equal, and s/Parrot_str_equal/Parrot_str_not_equal/ was done in the relevant files.

This change cleared up the function's bad API. It did not address the refactoring needed to make client code read as if the improved API had always existed.

Problem:[[BR]]
This pattern occurs over 150 times in our code:
    {{{ if (Parrot_str_not_equal(foo,bar) == 0) {...} }}}
This is a violation of PDD07, in the section ""Avoid double negatives"".

Solution:[[BR]]
These phrases, and their equivalents:
{{{
    (Parrot_str_not_equal(foo,bar) == 0)
    (Parrot_str_not_equal(foo,bar) != 0)
}}}
should be refactored to simple booleans:
{{{
    Parrot_str_equal(foo,bar)
    Parrot_str_not_equal(foo,bar)
}}}
"	cage	closed	minor		core	trunk	low	fixed	refactor Parrot_str_equal Parrot_str_not_equal				all
