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

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

bulk88 via RT
April 28, 2015 19:35
[perl #122368] [PATCH] improve docs about mortal in perlguts
Message ID:
On Tue Jul 22 16:37:37 2014, tonyc wrote:
> On Tue Jul 22 08:35:48 2014, bulk88 wrote:
> > Unsmoked. See attached patch.
> "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.  Mortal can be thought of as attached a
> SV to
> Should probably be "Mortalization can be thought of attaching an SV to
> ..."[1]
> +the current scope of the Perl stack (but not putting the SV on the
> Perl stack),
> +and the SV will be freeded if nothing else wants it, when the scope
> is left.
> +Mortal is similar to a C++ smart pointer.
> There's a enough differences that this comparison might be confusing.
> Anyone else?
> Tony
> [1] I pronounce SV as ess-vee, so "an" instead of "a", perlguts uses
> "a SV" once, "an SV" several times

-freeded fixed,
-analogy to "perl stack" removed and replaced with another analogy
-a replace with an
-example expanded of when it is safe to return an SV on perl stack without sv_2mortal

bulk88 ~ bulk88 at

via perlbug:  queue: perl5 status: open Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About