develooper Front page | perl.perl5.porters | Postings from December 2021

Re: "no snails"; or having signatured subs complain about @_

Thread Previous | Thread Next
From:
Dan Book
Date:
December 7, 2021 23:12
Subject:
Re: "no snails"; or having signatured subs complain about @_
Message ID:
CABMkAVUGsdLUvZOApMeLK=_f5WYUo0zjjGFfXBUan9NXxDqHxg@mail.gmail.com
On Mon, Dec 6, 2021 at 12:50 PM Paul "LeoNerd" Evans <leonerd@leonerd.org.uk>
wrote:

> On Mon, 6 Dec 2021 17:57:27 +0100 (CET)
> Tina Müller <post@tinita.de> wrote:
>
> > On Mon, 29 Nov 2021, Paul "LeoNerd" Evans wrote:
> >
> > > The final part of the "signatures" feature still to be implemented,
> > > is getting rid of the @_ setup as part of OP_ENTERSUB when entering
> > > a signature'd sub, for the speed benefit it gives. I've been
> > > thinking about how to implement this.
> >
> > Sorry if this has been discussed before somewhere, but I'm wondering
> > how to assign values to @_ when using signatures. Is there a way, or
> > will there be?
> >
> > e.g.
> >
> >      sub inc($x) {
> >          $_[0]++  # how to do this?
> >      }
>
> Short answer; "don't do that".
>
> Longer answer: Maybe we'll consider some sort of `:alias` attribute for
> permitting that at some future time:
>
>   sub inc($x :alias) { $x++ }
>

Relevant:

https://github.com/Perl/perl5/issues/15360
https://github.com/Perl/perl5/issues/15919
https://github.com/Perl/perl5/issues/16259

-Dan

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