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

Description of the cmp operator seems weird #1036

Closed
titsuki opened this issue Dec 6, 2016 · 1 comment
Closed

Description of the cmp operator seems weird #1036

titsuki opened this issue Dec 6, 2016 · 1 comment
Assignees
Labels
docs Documentation issue (primary issue type)

Comments

@titsuki
Copy link
Member

titsuki commented Dec 6, 2016

In this section: https://docs.perl6.org/type/Order#infix_cmp
it says "Coerces it's arguments to Stringy."

However, in the other section: https://docs.perl6.org/routine/cmp#(Operators)_infix_cmp
it says "Compares strings with string semantics, numbers with number semantics, Pair objects first by key and then by value etc."

Which one is the correct description ?

@titsuki titsuki added the docs Documentation issue (primary issue type) label Dec 6, 2016
@nicqrocks
Copy link
Contributor

From looking at the code in Rakudo (See this link) it looks like it will primarily use the stringy form to compare it's arguments, but will use the same code that <=> does when it gets an Int type.
From this it looks like the description given in the Operators section of the docs is correct, and the description in the Order type needs to be changed.

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

3 participants