On Tue, Jun 07, 2005 at 06:54:40PM -0700, Yitzchak Scott-Thoennes wrote:
> I agree with the sentiment, but think it would be worth it (perhaps in
> conjuction with a short warning in perlfunc/exists that exists on @_
> or @DB::args may not work).

But it can happen in other circumstances too. Eg XS code that does

    av_store(av, n, &PL_sv_undef)

> 
> The only complete fix I see would be to also make av_reify replace all
> PL_sv_undefs with new sv's, something like (untested):
> 
> --- perl/av.c.orig      2005-06-02 01:07:41.000000000 -0700
> +++ perl/av.c   2005-06-07 16:25:15.358164800 -0700
> @@ -40,6 +40,8 @@ Perl_av_reify(pTHX_ AV *av)
>         assert(sv);
>         if (sv != &PL_sv_undef)
>             (void)SvREFCNT_inc(sv);
> +       else
> +            AvARRAY(av)[key] = newSV(0);
>      }
>      key = AvARRAY(av) - AvALLOC(av);
>      while (key)
> 
> This doesn't seem like too awful a penalty to pay for making exists()
> work consistently.

This seems reasonable

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

Reply via email to