develooper Front page | perl.perl5.porters | Postings from February 2023

Re: PERL_RC_STACK branch: first cut

Thread Previous | Thread Next
From:
"Ruud H.G. van Tol" via perl5-porters
Date:
February 27, 2023 12:40
Subject:
Re: PERL_RC_STACK branch: first cut
Message ID:
ab5be298-67d8-587c-e67e-7f5fd76eb0ae@isolution.nl

On 2023-02-27 13:17, demerphq wrote:
> On Mon, 27 Feb 2023 at 12:45, Ruud H.G. van Tol via perl5-porters 
> <perl5-porters@perl.org> wrote:
>
>     I don't see (yet) how/why it should print out "foo".\
>
>     Why would you want/expect it to print "foo",
>     when you are using aliased parameters,
>     and are deliberately emptying the array?
>
>
> Because the scalar that holds "foo" has been pushed onto the stack 
> independently of the array that originally contains it. The fact that 
> perl aliases arguments is a key part of this bug. If the stack was 
> refcounted the alias would not be freed until the scalar was popped 
> from the stack.

OK, so then it (partly) comes down to what one interprets (?) as aliasing.
I still think it was fine to print nothing (or to complain about undefined).

The "prematurely freed" thing is then (IMO) another issue.
In my view, that free() should remain in a cleanup-queue
until the (intermediately undef-ed) value is no longer "busy".

So the "prematurely freed" is certainly a bug,
but he undef-ing should IMO still happen,
as that is just what the code does.

-- Ruud


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