RT #131328: Delete does not work on % slices

#  <altr...@alt...>

Fri, 19 May 2017 03:40:45 -0700
This is a bug report for perl from [email protected], generated with the help of perlbug 1.40 running under perl 5.20.1. ----------------------------------------------------------------- The `delete` operator deletes one or many keys from a hash and returns the deleted values. This works on $ and @ sections of a hash. It seems logical that if one were to run delete on a % section of a hash, it would return the k-v-pair list that was deleted. my %sanitised_values = delete %input_values{@allowed_keys}; warn "Unknown key $_" for keys %input_values; ----------------------------------------------------------------- --- Flags: category=core severity=wishlist --- Site configuration information for perl 5.20.1: Configured by alastair.mcgowan at Thu Jan 29 12:23:29 GMT 2015. Summary of my perl5 (revision 5 version 20 subversion 1) configuration: Platform: osname=linux, osvers=3.13.0-43-generic, archname=x86_64-linux uname='linux dev-05 3.13.0-43-generic #72-ubuntu smp mon dec 8 19:35:06 utc 2014 x86_64 x86_64 x86_64 gnulinux ' config_args='-de -Dprefix=/home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1 -Aeval:scriptdir=/home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1/bin' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='', gccversion='4.8.2', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags =' -fstack-protector -L/usr/local/lib' libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib libs=-lnsl -ldl -lm -lcrypt -lutil -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc libc=libc-2.19.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.19' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector' Locally applied patches: Devel::PatchPerl 1.30 --- @INC for perl 5.20.1: /home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1/lib/site_perl/5.20.1/x86_64-linux /home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1/lib/site_perl/5.20.1 /home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1/x86_64-linux /home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1 . --- Environment for perl 5.20.1: HOME=/home/alastair.mcgowan LANG=en_GB.UTF-8 LANGUAGE=en_GB:en LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/home/alastair.mcgowan/venv/bin:/home/alastair.mcgowan/src/rakudobrew/bin:/home/alastair.mcgowan/src/mg-scripts:/home/alastair.mcgowan/bin:/home/alastair.mcgowan/GitScripts:/home/alastair.mcgowan/perl5/perlbrew/bin:/home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1/bin:/home/alastair.mcgowan/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games PERLBREW_BASHRC_VERSION=0.66 PERLBREW_HOME=/home/alastair.mcgowan/.perlbrew PERLBREW_MANPATH=/home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1/man PERLBREW_PATH=/home/alastair.mcgowan/perl5/perlbrew/bin:/home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1/bin PERLBREW_PERL=perl-5.20.1 PERLBREW_ROOT=/home/alastair.mcgowan/perl5/perlbrew PERLBREW_VERSION=0.66 PERL_BADLANG (unset) SHELL=/bin/bash

# James E Keenan <jkee...@cpa...>

Fri, 19 May 2017 04:20:31 -0700
On Fri, 19 May 2017 10:40:45 GMT, [email protected] wrote: > > This is a bug report for perl from [email protected], > generated with the help of perlbug 1.40 running under perl 5.20.1. > > > ----------------------------------------------------------------- > > The `delete` operator deletes one or many keys from a hash and returns > the > deleted values. This works on $ and @ sections of a hash. > > It seems logical that if one were to run delete on a % section of a > hash, it > would return the k-v-pair list that was deleted. > > my %sanitised_values = delete %input_values{@allowed_keys}; > warn "Unknown key $_" for keys %input_values; > > Can you explain your concept of the '$', '@' and '%' "sections" of a hash? I have been programming in Perl for some time and have never heard of "sections" of a hash. Nor can I find any mention of them in the documentation. Thank you very much. Jim Keenan ----------------------------------------------------------------- > --- > Flags: > category=core > severity=wishlist > --- > Site configuration information for perl 5.20.1: > > Configured by alastair.mcgowan at Thu Jan 29 12:23:29 GMT 2015. > > Summary of my perl5 (revision 5 version 20 subversion 1) > configuration: > > Platform: > osname=linux, osvers=3.13.0-43-generic, archname=x86_64-linux > uname='linux dev-05 3.13.0-43-generic #72-ubuntu smp mon dec 8 > 19:35:06 utc 2014 x86_64 x86_64 x86_64 gnulinux ' > config_args='-de > -Dprefix=/home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1 > -Aeval:scriptdir=/home/alastair.mcgowan/perl5/perlbrew/perls/perl- > 5.20.1/bin' > hint=recommended, useposix=true, d_sigaction=define > useithreads=undef, usemultiplicity=undef > use64bitint=define, use64bitall=define, uselongdouble=undef > usemymalloc=n, bincompat5005=undef > Compiler: > cc='cc', ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack- > protector -I/usr/local/include -D_LARGEFILE_SOURCE > -D_FILE_OFFSET_BITS=64', > optimize='-O2', > cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector > -I/usr/local/include' > ccversion='', gccversion='4.8.2', gccosandvers='' > intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 > d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 > ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', > lseeksize=8 > alignbytes=8, prototype=define > Linker and Libraries: > ld='cc', ldflags =' -fstack-protector -L/usr/local/lib' > libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.8/include- > fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu > /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib > libs=-lnsl -ldl -lm -lcrypt -lutil -lc > perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc > libc=libc-2.19.so, so=so, useshrplib=false, libperl=libperl.a > gnulibc_version='2.19' > Dynamic Linking: > dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' > cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack- > protector' > > Locally applied patches: > Devel::PatchPerl 1.30 > > --- > @INC for perl 5.20.1: > /home/alastair.mcgowan/perl5/perlbrew/perls/perl- > 5.20.1/lib/site_perl/5.20.1/x86_64-linux > /home/alastair.mcgowan/perl5/perlbrew/perls/perl- > 5.20.1/lib/site_perl/5.20.1 > /home/alastair.mcgowan/perl5/perlbrew/perls/perl- > 5.20.1/lib/5.20.1/x86_64-linux > /home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1 > . > > --- > Environment for perl 5.20.1: > HOME=/home/alastair.mcgowan > LANG=en_GB.UTF-8 > LANGUAGE=en_GB:en > LD_LIBRARY_PATH (unset) > LOGDIR (unset) > PATH=/home/alastair.mcgowan/venv/bin:/home/alastair.mcgowan/src/rakudobrew/bin:/home/alastair.mcgowan/src/mg- > scripts:/home/alastair.mcgowan/bin:/home/alastair.mcgowan/GitScripts:/home/alastair.mcgowan/perl5/perlbrew/bin:/home/alastair.mcgowan/perl5/perlbrew/perls/perl- > 5.20.1/bin:/home/alastair.mcgowan/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games > PERLBREW_BASHRC_VERSION=0.66 > PERLBREW_HOME=/home/alastair.mcgowan/.perlbrew > PERLBREW_MANPATH=/home/alastair.mcgowan/perl5/perlbrew/perls/perl- > 5.20.1/man > PERLBREW_PATH=/home/alastair.mcgowan/perl5/perlbrew/bin:/home/alastair.mcgowan/perl5/perlbrew/perls/perl- > 5.20.1/bin > PERLBREW_PERL=perl-5.20.1 > PERLBREW_ROOT=/home/alastair.mcgowan/perl5/perlbrew > PERLBREW_VERSION=0.66 > PERL_BADLANG (unset) > SHELL=/bin/bash -- James E Keenan ([email protected])

# The RT System itself <>

Fri, 19 May 2017 04:20:31 -0700
Status changed from new to open.

# Lukas Mai <plok...@gma...>

Fri, 19 May 2017 04:23:41 -0700
Am 19.05.2017 um 13:20 schrieb James E Keenan via RT: > On Fri, 19 May 2017 10:40:45 GMT, [email protected] wrote: >> >> The `delete` operator deletes one or many keys from a hash and returns >> the >> deleted values. This works on $ and @ sections of a hash. >> >> It seems logical that if one were to run delete on a % section of a >> hash, it >> would return the k-v-pair list that was deleted. >> >> my %sanitised_values = delete %input_values{@allowed_keys}; >> warn "Unknown key $_" for keys %input_values; >> >> > > Can you explain your concept of the '$', '@' and '%' "sections" of a hash? > > I have been programming in Perl for some time and have never heard of "sections" of a hash. Nor can I find any mention of them in the documentation. http://perldoc.perl.org/perldata.html#Slices -- Lukas Mai <[email protected]>

# James E Keenan <jkee...@cpa...>

Fri, 19 May 2017 04:33:44 -0700
On Fri, 19 May 2017 11:23:41 GMT, [email protected] wrote: > Am 19.05.2017 um 13:20 schrieb James E Keenan via RT: > > On Fri, 19 May 2017 10:40:45 GMT, [email protected] wrote: > >> > >> The `delete` operator deletes one or many keys from a hash and > >> returns > >> the > >> deleted values. This works on $ and @ sections of a hash. > >> > >> It seems logical that if one were to run delete on a % section of a > >> hash, it > >> would return the k-v-pair list that was deleted. > >> > >> my %sanitised_values = delete %input_values{@allowed_keys}; > >> warn "Unknown key $_" for keys %input_values; > >> > >> > > > > Can you explain your concept of the '$', '@' and '%' "sections" of a > > hash? > > > > I have been programming in Perl for some time and have never heard of > > "sections" of a hash. Nor can I find any mention of them in the > > documentation. > > http://perldoc.perl.org/perldata.html#Slices I'm familiar with slices. It's the OP's use of the term "sections" that puzzles me. Thank you very much. -- James E Keenan ([email protected])

# Dagfinn Ilmari Manns�ker <ilma...@ilm...>

Sat, 20 May 2017 06:23:20 -0700
(via RT) <[email protected]> writes: > The `delete` operator deletes one or many keys from a hash and returns the > deleted values. This works on $ and @ sections of a hash. > > It seems logical that if one were to run delete on a % section of a hash, it > would return the k-v-pair list that was deleted. > > my %sanitised_values = delete %input_values{@allowed_keys}; > warn "Unknown key $_" for keys %input_values; As is my wont, I thought "how hard could it possibly be" and had a go. Turns out not very hard at all, so the result is now on the smoke-me/ilmari/delete-kvslice branch and can be merged once 5.27 opens, unless anyone objects. https://perl5.git.perl.org/perl.git/commitdiff/smoke-me/ilmari/delete-kvslice -- "The surreality of the universe tends towards a maximum" -- Skud's Law "Never formulate a law or axiom that you're not prepared to live with the consequences of." -- Skud's Meta-Law

# Sawyer X <xsaw...@gma...>

Mon, 22 May 2017 02:20:59 -0700
On 05/20/2017 03:22 PM, Dagfinn Ilmari Mannsåker wrote: > (via RT) <[email protected]> writes: > >> The `delete` operator deletes one or many keys from a hash and returns the >> deleted values. This works on $ and @ sections of a hash. >> >> It seems logical that if one were to run delete on a % section of a hash, it >> would return the k-v-pair list that was deleted. >> >> my %sanitised_values = delete %input_values{@allowed_keys}; >> warn "Unknown key $_" for keys %input_values; > As is my wont, I thought "how hard could it possibly be" and had a go. > Turns out not very hard at all, so the result is now on the > smoke-me/ilmari/delete-kvslice branch and can be merged once 5.27 opens, > unless anyone objects. Also possible to merge to blead-next, which will be merged when 5.27 opens.

# Dagfinn Ilmari Manns�ker <ilma...@ilm...>

Fri, 02 Jun 2017 03:06:18 -0700
[email protected] (Dagfinn Ilmari Mannsåker) writes: > (via RT) <[email protected]> writes: > >> The `delete` operator deletes one or many keys from a hash and returns the >> deleted values. This works on $ and @ sections of a hash. >> >> It seems logical that if one were to run delete on a % section of a hash, it >> would return the k-v-pair list that was deleted. >> >> my %sanitised_values = delete %input_values{@allowed_keys}; >> warn "Unknown key $_" for keys %input_values; > > As is my wont, I thought "how hard could it possibly be" and had a go. > Turns out not very hard at all, so the result is now on the > smoke-me/ilmari/delete-kvslice branch and can be merged once 5.27 opens, > unless anyone objects. > > https://perl5.git.perl.org/perl.git/commitdiff/smoke-me/ilmari/delete-kvslice This is now in blead as commit cc0776d645a326dd0aaa2dbd8cd9b014c63723f5. -- "I use RMS as a guide in the same way that a boat captain would use a lighthouse. It's good to know where it is, but you generally don't want to find yourself in the same spot." - Tollef Fog Heen

# yves orton <deme...@gma...>

Fri, 02 Jun 2017 05:17:36 -0700
On 2 June 2017 at 12:05, Dagfinn Ilmari Mannsåker <[email protected]> wrote: > [email protected] (Dagfinn Ilmari Mannsåker) writes: > >> (via RT) <[email protected]> writes: >> >>> The `delete` operator deletes one or many keys from a hash and returns the >>> deleted values. This works on $ and @ sections of a hash. >>> >>> It seems logical that if one were to run delete on a % section of a hash, it >>> would return the k-v-pair list that was deleted. >>> >>> my %sanitised_values = delete %input_values{@allowed_keys}; >>> warn "Unknown key $_" for keys %input_values; >> >> As is my wont, I thought "how hard could it possibly be" and had a go. >> Turns out not very hard at all, so the result is now on the >> smoke-me/ilmari/delete-kvslice branch and can be merged once 5.27 opens, >> unless anyone objects. >> >> https://perl5.git.perl.org/perl.git/commitdiff/smoke-me/ilmari/delete-kvslice > > This is now in blead as commit cc0776d645a326dd0aaa2dbd8cd9b014c63723f5. I'll just note that the new syntax was an error in previous perl's, in case anyone was wondering like I was. Which is real cool. Thanks for making it happen! cheers, Yves -- perl -Mre=debug -e "/just|another|perl|hacker/"