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

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

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
December 9, 2021 17:27
Subject:
Re: "no snails"; or having signatured subs complain about @_
Message ID:
YbI8XmR44C9hbaFe@iabyn.com
On Thu, Dec 09, 2021 at 04:29:13PM +0000, Paul "LeoNerd" Evans wrote:
> Yeah sure; it's not great. But it's something that lots of existing
> code on CPAN and elsewhere does, right now, so it would be nice if we
> could keep that working.

If they want to keep on doing that, they're free to continue using
'classic' subs.

> OK, that's a detail I hadn't been aware of before. Keeping the values on
> the stack does increase memory usage overall

No, because the values can be popped off the stack once assigning args to
params is done. (Although, they'd have to be kept in the presence of 'perl
-d' in order to keep caller() and @DB::args working).

> Based on your intention of leaving argument values on the stack I could
> also have a go at hacking up pp_entersub and the pp_arg* ops to work
> with that, though at present I can't quite imagine how they'll find
> their values from the stack once the actual body of the function has
> begun executing (e.g. during the default expression code). My thoughts
> are mostly described as the various part 3 sections of

Once default argument expressions have started executing, all the args on
the stack will have been consumed and are no longer needed.

-- 
"I do not resent criticism, even when, for the sake of emphasis,
it parts for the time with reality".
    -- Winston Churchill, House of Commons, 22nd Jan 1941.

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