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

Cannot use refalias with subroutine signatures #15919

Open
p5pRT opened this issue Mar 10, 2017 · 6 comments
Open

Cannot use refalias with subroutine signatures #15919

p5pRT opened this issue Mar 10, 2017 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented Mar 10, 2017

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

Searchable as RT130971$

@p5pRT
Copy link
Author

p5pRT commented Mar 10, 2017

From pm@vrkosk.iki.fi

Created by pm@vrkosk.iki.fi

It would be very nice to be able to use the refalias feature in
combination with subroutine signatures. On 5.24.1, the following
is a syntax error​:

  use feature 'refaliasing';
  use feature 'signatures';
  sub test ($scalar, \@​array, \%hash) {
  }

The following of course works and has the same intended meaning​:

  use feature 'refaliasing';
  sub test {
  (my $scalar, \my @​array, \my %hash) = @​_;
  }

Probably intimately related to refalias + signatures is that
the following is also a syntax error​:

  use feature 'refaliasing';
  sub test {
  my ($scalar, \@​array, \%hash) = @​_;
  }

Perl Info

Flags:
    category=core
    severity=wishlist

Site configuration information for perl 5.24.1:

Configured by villek at Thu Mar  9 10:29:14 GMT 2017.

Summary of my perl5 (revision 5 version 24 subversion 1) configuration:
   
  Platform:
    osname=linux, osvers=4.4.49-16-default,
    archname=x86_64-linux-thread-multi
    uname='linux t440p-vrk 4.4.49-16-default #1 smp sun feb 19 17:40:35
    utc 2017 (70e9954) x86_64 x86_64 x86_64 gnulinux '
    config_args='-Dprefix=/home/villek/perldist/perl-5.24.1'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fwrapv
    -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include
    -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2',
    optimize='-O2',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing
    -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.8.5', 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='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib
    /usr/lib64/gcc/x86_64-suse-linux/4.8/include-fixed
    /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/lib
    /usr/lib /lib/../lib64 /usr/lib/../lib64 /lib /lib64 /usr/lib64
    /usr/local/lib64
    libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
    -lgdbm_compat
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.22.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.22'
  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'



@INC for perl 5.24.1:
    /home/villek/perldist/perl-5.24.1/lib/site_perl/5.24.1/x86_64-linux-thread-multi
    /home/villek/perldist/perl-5.24.1/lib/site_perl/5.24.1
    /home/villek/perldist/perl-5.24.1/lib/5.24.1/x86_64-linux-thread-multi
    /home/villek/perldist/perl-5.24.1/lib/5.24.1


Environment for perl 5.24.1:
    HOME=/home/villek
    LANG=de_DE.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/usr/lib64/mpi/gcc/openmpi/lib64
    LOGDIR (unset)
    PATH=/usr/lib64/mpi/gcc/openmpi/bin:/home/villek/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/opt/kde3/bin:/usr/lib/mit/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Mar 21, 2017

From @rjbs

I, too, would like to see refaliasing via subroutine signatures.

There is or was another ticket related to being able to put the \ on the inside of my declarations. I believe sprout did some work on that front.

--
rjbs

@p5pRT
Copy link
Author

p5pRT commented Mar 21, 2017

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

@p5pRT
Copy link
Author

p5pRT commented Mar 22, 2017

From @cpansprout

On Tue, 21 Mar 2017 06​:08​:14 -0700, rjbs wrote​:

I, too, would like to see refaliasing via subroutine signatures.

There is or was another ticket related to being able to put the \ on
the inside of my declarations. I believe sprout did some work on that
front.

In 5.26-to-be, you can use the ‘declared_refs’ feature to allow my(\%foo). I honestly don’t remember whether I got as far as applying it to signatures. I don’t think so. I am too lazy to build blead to find out.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Mar 22, 2017

From @iabyn

On Tue, Mar 21, 2017 at 05​:43​:32PM -0700, Father Chrysostomos via RT wrote​:

In 5.26-to-be, you can use the ‘declared_refs’ feature to allow
my(\%foo). I honestly don’t remember whether I got as far as applying
it to signatures. I don’t think so. I am too lazy to build blead to
find out.

I suggested holding off, as I was working on signatures at the time,
and probably wanted to do things a bit differently.

--
I don't want to achieve immortality through my work...
I want to achieve it through not dying.
  -- Woody Allen

@p5pRT
Copy link
Author

p5pRT commented Mar 22, 2017

From pm@vrkosk.iki.fi

On Wed, 22 Mar 2017, at 00​:43, Father Chrysostomos via RT wrote​:

In 5.26-to-be, you can use the ‘declared_refs’ feature to allow
my(\%foo). I honestly don’t remember whether I got as far as applying it
to signatures. I don’t think so. I am too lazy to build blead to find
out.

Oh, that's fantastic! If declared_refs doesn't do it for signatures in
5.26, I don't mind at all waiting for 5.28.

(For years at $work, I've been documenting function return values using
my (\@​foo, \%bar) and so on. It's very nice to find it will be a real
feature.)

Regards,
Ville Koskinen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants