Subject: | True love in documentation can't be found (it's backwards) |
I was trying to understand why "True love" in the documentation was
impossible to find. It boiled down to this example:
use Quantum::Superpositions;
my $all = all("smart","Australian","rich");
my $any = any("smart","Australian","rich");
print "Yes 1\n" if $all eq $any;
print "Yes 2\n" if $any eq $all;
__END__
Yes 1
That is the order of comparison matters. (For reasons that are not
that hard to figure out.) Therefore you can never find "True love"
from this documented snippet (the any and all are reversed):
$ideal = any( all("tall", "rich", "handsome"),
all("rich", "old"),
all("smart","Australian","rich")
);
while (@features = get_description)
{
if (any(@features) eq $ideal)
{
print "True love";
}
}
I think that this order dependency should be clearly documented,
and the documentation example should either be fixed by switching
any(@features) with $ideal, or else it should be documented that
"True love" is impossible to find (and why).