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

Owner: Nobody
Requestors: cpan [at] zoffix.com
Cc:
AdminCc:

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



Subject: Hash slice with structured list does not come out structured
Download (untitled) / with headers
text/plain 559b
If you give a structured list as an Array slice, you get structured data back: my @a = 'a'..'z'; dd @a[(1, 2, 3), (5, (6, 7), (8, 9))]; # OUTPUT: (("b", "c", "d"), ("f", ("g", "h"), ("i", "j"))) But if you give the same type of structured list to a hash slice, you get flat data back: my %a = 'a'..'z'; dd %a{<a c e>, (<g i k>, ('m', ('o')))}; # OUTPUT: ("b", "d", "f", "h", "j", "l", "n", "p") I'd expect the hash slice to be equally structured and give this back: # OUTPUT: (("b", "d", "f"), (("h", "j", "l"), ("n", ("p"))))
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 331b
Turns out the rabbit hole goes deeper. Adverbs appear to not work if slice is structured: my %a = 'a'..'z'; dd %a{<a c e>, (<g i k>, ('m', ('o')))}:kv; # OUTPUT: () %a{<a c e>, (<g i k>, ('m', ('o')))}:delete; dd +%a.keys; # OUTPUT: 13 Shouldn't it give structured `kv` data back and delete at least some keys?
To: perl6-bugs-followup [...] perl.org
Date: Tue, 1 Aug 2017 14:47:05 +0200
Subject: Re: [perl #131826] Hash slice with structured list does not come out structured
From: Elizabeth Mattijsen <liz [...] dijkmat.nl>
Download (untitled) / with headers
text/plain 555b
Show quoted text
> On 1 Aug 2017, at 14:36, Zoffix Znet via RT <perl6-bugs-followup@perl.org> wrote: > > Turns out the rabbit hole goes deeper. Adverbs appear to not work if slice is structured: > > my %a = 'a'..'z'; > dd %a{<a c e>, (<g i k>, ('m', ('o')))}:kv; # OUTPUT: () > %a{<a c e>, (<g i k>, ('m', ('o')))}:delete; > dd +%a.keys; # OUTPUT: 13 > > Shouldn't it give structured `kv` data back and delete at least some keys?
I wonder whether we shouldn’t make all of the slicing lazy. So instead of returning a reified List, it would return a Seq.


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