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

List.Set loses Pair elements #6147

Closed
p6rt opened this issue Mar 10, 2017 · 7 comments
Closed

List.Set loses Pair elements #6147

p6rt opened this issue Mar 10, 2017 · 7 comments

Comments

@p6rt
Copy link

p6rt commented Mar 10, 2017

Migrated from rt.perl.org#130976 (status was 'resolved')

Searchable as RT130976$

@p6rt
Copy link
Author

p6rt commented Mar 10, 2017

From zefram@fysh.org

Coercing from List to Set, where the List contains a Pair element​:

(​:a,3).perl
(​:a, 3)
(​:a,3).Set.perl
set("a",3)
(​:!a,3).perl
(​:!a, 3)
(​:!a,3).Set.perl
set(3)

I'd expect the coercion to yield a Set that contains a Pair element.
(Such a Set can readily be constructed by other means.) Instead it's
either replacing the Pair with its key or ignoring the Pair entirely.

-zefram

@p6rt
Copy link
Author

p6rt commented Mar 12, 2017

From @smls

Not a bug, and explained in the docs​:

https://docs.perl6.org/type/Set#Creating_Set_objects

Use set() or Set.new() to get the behavior you want.

@p6rt
Copy link
Author

p6rt commented Mar 12, 2017

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

@p6rt
Copy link
Author

p6rt commented Mar 12, 2017

From zefram@fysh.org

Sam S. via RT wrote​:

Not a bug, and explained in the docs​:

Fair enough. For the record, I didn't think to look at that bit of the
documentation​: I looked at the List class, which is silent about coercion
to Set, and at its superclass Any, which has a cryptic description that
I found difficult to interpret but which definitely doesn't say anything
about special behaviour for Pairs. Some description of coercing behaviour
on the source-type side would be useful; at least a pointer to the Set
doc section that describes the Pair thing.

-zefram

@p6rt
Copy link
Author

p6rt commented Mar 12, 2017

From @AlexDaniel

There are some tests for it here​: https://github.com/perl6/roast/blob/master/S02-types/set.t#L62-L72

However, Bools are not tested. Not sure if it is a reasonable assumption that bools will be covered by these tests, so I'd say we add to extra tests before closing this just in case.

Zefram, can you open a corresponding doc issue for the problem?

On 2017-03-12 04​:20​:30, zefram@​fysh.org wrote​:

Sam S. via RT wrote​:

Not a bug, and explained in the docs​:

Fair enough. For the record, I didn't think to look at that bit of the
documentation​: I looked at the List class, which is silent about coercion
to Set, and at its superclass Any, which has a cryptic description that
I found difficult to interpret but which definitely doesn't say anything
about special behaviour for Pairs. Some description of coercing behaviour
on the source-type side would be useful; at least a pointer to the Set
doc section that describes the Pair thing.

-zefram

@p6rt
Copy link
Author

p6rt commented Sep 22, 2017

From @zoffixznet

Tests added​: Raku/roast@1e20619853

@p6rt
Copy link
Author

p6rt commented Sep 22, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant