develooper Front page | perl.perl5.porters | Postings from April 2018

[perl #133109] push on scalar forbidden: why?

Thread Previous | Thread Next
From:
Linda Walsh
Date:
April 13, 2018 23:32
Subject:
[perl #133109] push on scalar forbidden: why?
Message ID:
rt-4.0.24-24845-1523662311-1024.133109-75-0@perl.org
# New Ticket Created by  Linda Walsh 
# Please include the string:  [perl #133109]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=133109 >



This is a bug report for perl from perl-diddler@tlinx.org,
generated with the help of perlbug 1.40 running under perl 5.26.1.


-----------------------------------------------------------------
[Please describe your issue here]

If a scaler is null or an ARRAY ref, why shouldn't perl be
able to treat it as one in a context where a non-ARRAY ref would generate
an error?

ex: 
  my $aref;
  push	$aref, 1;

I'm aware an alternate way to do this was added, but perl, like many
languages often has multiple ways to do something.  More so in
perl in that a major feature in perl is autovivification.

This is a perfect example of perl autovivifying an array 
ref to use as an array needed by push.  So why would it be
"forbidden".

Even more curious is that perl is a permissive language.  If you
want to do something it will usually let you -- assuming that
the user is in a position to better know what is wanted/needed
in a specific circumstance.  I remember a discussion of
perl's OO design and how perl doesn't enforce class boundaries
or the concept of 'private', by _default_.  While extensions
can can add such things, nothing is forbidden.  So why would
something that used to work be made "forbidden"?  

Can perl be allowed to do the right thing when perl already knows
what it is?

Thanks,


[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=high
---
Site configuration information for perl 5.26.1:

Configured by ASSI at Tue Sep 26 18:50:45 CEST 2017.

Summary of my perl5 (revision 5 version 26 subversion 1) configuration:
   
  Platform:
    osname=cygwin
    osvers=2.9.0(0.31853)
    archname=x86_64-cygwin-threads-multi
    uname='cygwin_nt-6.3 cygwin 2.9.0(0.31853) 2017-09-12 10:18 x86_64 cygwin '
    config_args='-des -Dprefix=/usr -Dmksymlinks -Darchname=x86_64-cygwin-threads -Dlibperl=cygperl5_26.dll -Dcc=gcc -Dld=g++ -Accflags=-ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/mnt/share/maint/perl.x86_64/build=/usr/src/debug/perl-5.26.1-1 -fdebug-prefix-map=/mnt/share/maint/perl.x86_64/src/perl-5.26.1=/usr/src/debug/perl-5.26.1-1 -fwrapv'
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=define
    usemultiplicity=define
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
    bincompat5005=undef
  Compiler:
    cc='gcc'
    ccflags ='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -D_GNU_SOURCE -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/mnt/share/maint/perl.x86_64/build=/usr/src/debug/perl-5.26.1-1 -fdebug-prefix-map=/mnt/share/maint/perl.x86_64/src/perl-5.26.1=/usr/src/debug/perl-5.26.1-1 -fwrapv -fno-strict-aliasing -fstack-protector-strong -D_FORTIFY_SOURCE=2'
    optimize='-O3'
    cppflags='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -D_GNU_SOURCE -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/mnt/share/maint/perl.x86_64/build=/usr/src/debug/perl-5.26.1-1 -fdebug-prefix-map=/mnt/share/maint/perl.x86_64/src/perl-5.26.1=/usr/src/debug/perl-5.26.1-1 -fwrapv -fno-strict-aliasing -fstack-protector-strong'
    ccversion=''
    gccversion='6.4.0'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    ivtype='long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='g++'
    ldflags =' -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -fstack-protector-strong'
    libpth=/usr/lib
    libs=-lpthread -lgdbm -ldb -ldl -lcrypt -lgdbm_compat
    perllibs=-lpthread -ldl -lcrypt
    libc=/usr/lib/libcygwin.a
    so=dll
    useshrplib=true
    libperl=cygperl5_26.dll
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=dll
    d_dlsymun=undef
    ccdlflags=' '
    cccdlflags=' '
    lddlflags=' --shared  -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -fstack-protector-strong'

Locally applied patches:
    Cygwin: README
    Cygwin: use auto-image-base instead of fixed DLL base address
    Cygwin: modify hints
    Cygwin: Configure correct libsearch
    Cygwin: Configure correct libpth
    Cygwin: Win32 correct UTF8 handling
    Perl: File-Path-2.14 (fixes CVE2017-6512)

---
@INC for perl 5.26.1:
    /usr/local/lib/perl5/site_perl/5.26/x86_64-cygwin-threads
    /usr/local/share/perl5/site_perl/5.26
    /usr/lib/perl5/vendor_perl/5.26/x86_64-cygwin-threads
    /usr/share/perl5/vendor_perl/5.26
    /usr/lib/perl5/5.26/x86_64-cygwin-threads
    /usr/share/perl5/5.26

---
Environment for perl 5.26.1:
    CYGWIN=system nodosfilewarning winsymlinks:native export
    HOME=/Users/l.B
    LANG (unset)
    LANGUAGE (unset)
    LC_COLLATE=C
    LC_CTYPE=en_US.UTF-8
    LC_MESSAGES=C
    LC_MONETARY=C
    LC_NUMERIC=C
    LC_TIME=C
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=.:.:/usr/bin:/sbin:/prog64/vim/current:/Prog64/VanDyke Software/SecureCRT:/Prog/Sysinternals/cmd:/Prog/Sysinternals:/Prog/Common Files/DivX Shared:/Prog/QuickTime:/Prog/QuickTime/QTSystem:/Prog/NVIDIA Corporation/PhysX/Common:/Prog64/Razer Chroma SDK/bin:/Prog/Razer Chroma SDK/bin:/Windows/system32:/Windows:/Windows/System32/Wbem:/Prog64/Process Lasso:/usr/sbin:/Users/l.B/bin:/Users/l.B/bin/lib:/usr/local/bin:/bin:/etc/local/func_lib
    PERL_BADLANG (unset)
    SHELL=C:/Bin/Bash.exe


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About