Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"cmp will first try to compare operands as strings (via coercion to Stringy)" NOPE #4401

Open
raiph opened this issue Nov 18, 2023 · 1 comment
Labels
docs Documentation issue (primary issue type)

Comments

@raiph
Copy link
Contributor

raiph commented Nov 18, 2023

Infix cmp doc begins:

cmp will first try to compare operands as strings (via coercion to Stringy)

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.

@raiph raiph added the docs Documentation issue (primary issue type) label Nov 18, 2023
@2colours
Copy link
Contributor

To trace the issue back:

a90a5e5
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).

#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation issue (primary issue type)
Projects
None yet
Development

No branches or pull requests

2 participants