doc
doc copied to clipboard
"`cmp` will first try to compare operands as strings (via coercion to `Stringy`)" NOPE
Infix cmp doc begins:
cmpwill first try to compare operands as strings (via coercion toStringy)
Not true (and I don't think it's ever been true):
say <42+0i>.Stringy cmp <5+0i>.Stringy; # Less
say 42+0i cmp 5+0i ; # More
Note that this has nothing to do with Stringy or complex numbers.
The doc simply misstates cmp's logic.
To trace the issue back:
https://github.com/Raku/doc/commit/a90a5e51c2e1188b729ce7f2f6ba46b873ad1963
The original description was already wrong. Probably there was a misunderstanding about cmp being the stringy version of <=> (that's actually leg which is somehow not even mentioned at Order and has a completely different signature).
https://github.com/Raku/doc/issues/1036 already pointed this out but the fix applied went the wrong way around it.
However, I tend to question whether cmp and <=> even have to be there. Sure, the output type of these operations are Orders but usually one would list the operations to be performed on the particular data type. I think it would be enough to informally illustrate that comparison operations (including leg actually) produce Order values, and put the type graph there. If there are specific operations for Orders then those could be added but I don't think there are (m)any.