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

Definition of infix:<eqv> is not correct #3346

Open
JJ opened this issue Apr 23, 2020 · 2 comments
Open

Definition of infix:<eqv> is not correct #3346

JJ opened this issue Apr 23, 2020 · 2 comments
Labels
docs Documentation issue (primary issue type) RFE Request for enhancement. Try to use alternative wording that explain the concept more clearly

Comments

@JJ
Copy link
Contributor

JJ commented Apr 23, 2020

The problem

The definition of eqv in the Operators page is shown as

sub infix:<eqv>(Any, Any)

But that's only one of the possible definitions, there are dozens of them. Granted it's probably not a good idea to show each and every one of them, although there's a separate page, curiously enough, for the one that uses Matchas argument here.

Suggestions

Most limited change would simply be change Any to Mu, which makes much more sense. An extensive change would involve adding code to every class that can use it, or at least those that do so in a special way (for instance, eqv for allomorphs is special cased to be False if they are different)

@JJ JJ added docs Documentation issue (primary issue type) RFE Request for enhancement. Try to use alternative wording that explain the concept more clearly labels Apr 23, 2020
stoned added a commit that referenced this issue Jun 1, 2021
JJ pushed a commit that referenced this issue Jun 2, 2021
@coke coke self-assigned this Mar 5, 2023
@coke coke added this to the 2023-Quarter 1 milestone Mar 5, 2023
@coke coke removed their assignment Mar 5, 2023
@cfa
Copy link
Contributor

cfa commented Mar 8, 2023

I agree that we don't want to list all of the candidates on the operators page—there're far too many.

There's a related issue here, especially with the Any signature: eqv on an arbitrary class will test for identity or for equivalent type objects and raku strings. So these two instances are equal,

class A { has $.x; method raku { "bad idea" } }

A.new(x => 123) eqv A.new(x => 456);

In this case, the documentation is misleading as it suggests that all implementations of infix:<eqv> are expected to test whether parameters are of "the same type and (recursively) contain equivalent values".

@2colours
Copy link
Contributor

Most limited change would simply be change Any to Mu, which makes much more sense.

There is no Mu candidate so I really don't think this is a good idea; nothing really pushes us to all of a sudden document a fake candidate of one random operator.

I agree that we don't want to list all of the candidates on the operators page—there're far too many.

Hm, okay... would it be possible to not list them for the operators page but list them as part of the corresponding types?

In this case, the documentation is misleading as it suggests that all implementations of infix: are expected to test whether parameters are of "the same type and (recursively) contain equivalent values".

Yes, well... it makes sense - a different sense. "You are expected to provide the test (...)" Perhaps it should be rephrased to something that describes the general idea ("this is the operator that is meant to be overloaded when appropriate", as opposed to other equality checks) and also the default behavior,

@coke coke modified the milestones: 2023-Quarter 1, 2023-Quarter 2 Apr 1, 2023
@coke coke modified the milestones: 2023-Quarter 2, 2023-Quarter 3 Jul 12, 2023
@coke coke modified the milestones: 2023-Quarter 3, 2023-Quarter 4 Oct 8, 2023
@coke coke modified the milestones: 2023-Quarter 4, 2024-Quarter-2 Mar 31, 2024
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) RFE Request for enhancement. Try to use alternative wording that explain the concept more clearly
Projects
None yet
Development

No branches or pull requests

4 participants