develooper Front page | perl.perl5.porters | Postings from January 2022

Re: Benchmarking a 'no-snails' world (was: Re: PSC #049 2022-01-07)

Thread Previous | Thread Next
From:
Tom Molesworth via perl5-porters
Date:
January 17, 2022 23:17
Subject:
Re: Benchmarking a 'no-snails' world (was: Re: PSC #049 2022-01-07)
Message ID:
CAGXhHdmUKyJYJn3sXz3-3BewECJbEZGp5DOz9TMEEVcnqqc0DQ@mail.gmail.com
On Tue, 18 Jan 2022 at 06:52, Tony Cook <tony@develop-help.com> wrote:

> On Mon, Jan 17, 2022 at 06:28:19PM +0000, Paul "LeoNerd" Evans wrote:
> > since in order to make pp_arg* work at all we still have to
> > copy the args to the AV found in PAD_SVl(0).
>
> (Sorry I can't type a lot right now.)
>
> Can't entersub leave the arguments (and mark) on the stack for a
> signature sub and pp_argelem access the arguments on the stack
> instead?
>
> The final argelem would need to pop the mark and clean up the stack.
>
> This would save the cost of setting up the AV.
>

That sounds like a big change in behaviour? It seems like this would lead
to the following situation:

- everything in the signature is now an alias instead of a copy
- signature args are no longer refcounted (stack-not-refcounted has long
been a source of various problems!)

The first one would lead to very surprising behaviour with cases like `sub
ltrim ($x) { $x =~ s{^\s+}{}; $x }`, and the second likewise for lexical
captures such as `(sub ($x) { sub { $x }
})->($thing_that_drops_out_of_scope_shortly_after)`.

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