Skip Menu |
Report information
Id: 130976
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: zefram [at] fysh.org
Cc:
AdminCc:

Severity: (no value)
Tag: testneeded
Platform: (no value)
Patch Status: (no value)
VM: (no value)



From: Zefram <zefram [...] fysh.org>
Subject: [BUG] List.Set loses Pair elements
To: rakudobug [...] perl.org
Date: Fri, 10 Mar 2017 13:26:04 +0000
Download (untitled) / with headers
text/plain 388b
Coercing from List to Set, where the List contains a Pair element: Show quoted text
> (:a,3).perl
(:a, 3) Show quoted text
> (:a,3).Set.perl
set("a",3) Show quoted text
> (:!a,3).perl
(:!a, 3) Show quoted text
> (:!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
Download (untitled) / with headers
text/plain 145b
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.
Subject: Re: [perl #130976] [BUG] List.Set loses Pair elements
From: Zefram <zefram [...] fysh.org>
To: "Sam S. via RT" <perl6-bugs-followup [...] perl.org>
Date: Sun, 12 Mar 2017 11:19:36 +0000
Download (untitled) / with headers
text/plain 551b
Sam S. via RT wrote: Show quoted text
>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
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:
Show quoted text
> 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
>




This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org