From 833bf1cd69463bf6a806f451560f3a1039bd09ca Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Sun, 16 Jun 2013 12:40:05 -0700 Subject: [PATCH] Re(mov|writ)e two comments from pad.c:pad_alloc MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The thing about "foreach" index vars was added in bbce6d697 (insepar- able changes from patch from perl5.003_08 to perl5.003_09, presuma- bly the ‘Lexical scoping cleanup’ part). It is not valid, because ‘foreach’ doesn’t aliases a pad entry to a non-pad (not marked PADMY or PADTMP) value until run time, and pad_alloc happens at compile time. The real reason we need this loop is that entries that close over unavailable variables are not marked PADMY. That may have been a mistake, but it works because of this loop. The reason for the loop also may have changed over time. The comment about copying to sv is not valid, because it is used later on in the same condition when compared to &PL_sv_undef. It was added in commit dd2155a49b. --- pad.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pad.c b/pad.c index 15b2656..ec3ad84 100644 --- a/pad.c +++ b/pad.c @@ -750,11 +750,11 @@ Perl_pad_alloc(pTHX_ I32 optype, U32 tmptype) const SSize_t names_fill = AvFILLp(PL_comppad_name); for (;;) { /* - * "foreach" index vars temporarily become aliases to non-"my" - * values. Thus we must skip, not just pad values that are + * Entries that close over unavailable variables + * in outer subs contain values not marked PADMY. + * Thus we must skip, not just pad values that are * marked as current pad values, but also those with names. */ - /* HVDS why copy to sv here? we don't seem to use it */ if (++PL_padix <= names_fill && (sv = names[PL_padix]) && sv != &PL_sv_undef) continue; -- 2.7.4