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

"is" subroutine couldn't handle Set-valued Hash correctly in the specific case. #5203

Closed
p6rt opened this issue Mar 28, 2016 · 4 comments
Closed
Labels

Comments

@p6rt
Copy link

p6rt commented Mar 28, 2016

Migrated from rt.perl.org#127795 (status was 'rejected')

Searchable as RT127795$

@p6rt
Copy link
Author

p6rt commented Mar 28, 2016

From @titsuki

See the following results.

$ perl6 -e 'use Test; my Set (%a, %b); %a{"abc"} = %a{"abc"} (|) set(0,1,2); %a{"ab"} = %a{"ab"} (|) set(0); %b{"abc"}
= %b{"abc"} (|) set(1,0,2); %b{"ab"} = %b{"ab"} (|) set(0); is %a, %b;'
not ok 1 -

# Failed test at -e line 1
# expected​: 'ab 0
# abc 1 0 2'
# got​: 'ab 0
# abc 0 1 2'

If "is-deeply" subroutine is used, it should return "not ok".
But in this case, "is" subroutine is used. So it should return "ok".

@p6rt
Copy link
Author

p6rt commented Jul 10, 2016

From @zoffixznet

The `is` sub uses `eq` operator for comparison, which coerces items to Str.

So this ticket comes down to whether or not .Str on sets should sort their elements. The problem with that is sets can contain different types of objects. You could further put the argument that .Strs (or .gists) of those objects should be used and sorted, but that still leaves the issue of two differing sets producing the same .Str result​:

$ 6 'class Bar { method gist { "Foo" } }; say set Bar; say set "Foo"'
set(Foo)
set(Foo)

Thus, I'm closing this ticket, as it appears `is` sub is simply not an appropriate way to compare two sets.

@p6rt
Copy link
Author

p6rt commented Jul 10, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jul 10, 2016

@zoffixznet - Status changed from 'open' to 'rejected'

@p6rt p6rt closed this as completed Jul 10, 2016
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant