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

Delete does not work on % slices #15982

Open
p5pRT opened this issue May 19, 2017 · 9 comments
Open

Delete does not work on % slices #15982

p5pRT opened this issue May 19, 2017 · 9 comments
Labels

Comments

@p5pRT
Copy link
Collaborator

@p5pRT p5pRT commented May 19, 2017

Migrated from rt.perl.org#131328 (status was 'open')

Searchable as RT131328$

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented May 19, 2017

From altreus@altre.us

This is a bug report for perl from altreus@​altre.us,
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

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented May 19, 2017

From @jkeenan

On Fri, 19 May 2017 10​:40​:45 GMT, altreus@​altre.us wrote​:

This is a bug report for perl from altreus@​altre.us,
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 (jkeenan@​cpan.org)

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented May 19, 2017

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

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented May 19, 2017

From @mauke

Am 19.05.2017 um 13​:20 schrieb James E Keenan via RT​:

On Fri, 19 May 2017 10​:40​:45 GMT, altreus@​altre.us 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 <plokinom@​gmail.com>

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented May 19, 2017

From @jkeenan

On Fri, 19 May 2017 11​:23​:41 GMT, plokinom@​gmail.com wrote​:

Am 19.05.2017 um 13​:20 schrieb James E Keenan via RT​:

On Fri, 19 May 2017 10​:40​:45 GMT, altreus@​altre.us 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 (jkeenan@​cpan.org)

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented May 20, 2017

From @ilmari

(via RT) <perlbug-followup@​perl.org> 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

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented May 22, 2017

From @xsawyerx

On 05/20/2017 03​:22 PM, Dagfinn Ilmari Mannsåker wrote​:

(via RT) <perlbug-followup@​perl.org> 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.

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Jun 2, 2017

From @ilmari

ilmari@​ilmari.org (Dagfinn Ilmari Mannsåker) writes​:

(via RT) <perlbug-followup@​perl.org> 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 cc0776d.

--
"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

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Jun 2, 2017

From @demerphq

On 2 June 2017 at 12​:05, Dagfinn Ilmari Mannsåker <ilmari@​ilmari.org> wrote​:

ilmari@​ilmari.org (Dagfinn Ilmari Mannsåker) writes​:

(via RT) <perlbug-followup@​perl.org> 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 cc0776d.

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/"

@p5pRT p5pRT added the Severity Low label Oct 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.