develooper Front page | perl.perl5.porters | Postings from May 2015

[perl #122368] [PATCH] improve docs about mortal in perlguts

From:
Tony Cook via RT
Date:
May 27, 2015 07:03
Subject:
[perl #122368] [PATCH] improve docs about mortal in perlguts
Message ID:
rt-4.0.18-24149-1432710189-1183.122368-15-0@perl.org
On Tue Apr 28 12:35:10 2015, bulk88 wrote:
 "Mortalization" then is at its simplest a deferred C<SvREFCNT_dec>.
 However, if you mortalize a variable twice, the reference count will
-later be decremented twice.
+later be decremented twice.  Mortalization can be thought of attaching an SV to
+the current scope, or current executing statement of Perl code, and upon the
+change to the next Perl language scope (C<}>), or next Perl language statement
+(C<;>), or XS synthesis of those 2 Perl langauge concepts, the SV will be
+freed if nothing else wanted to retain the SV.  Mortal is similar to a C++
+smart pointer.

It might be better to just say that FREETMPS is called in those places.

Tony

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=122368



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About