On Mon, 6 Jun 2005 02:30:53 -0700, Yitzchak Scott-Thoennes <[EMAIL PROTECTED]>
wrote:

> On Sun, Jun 05, 2005 at 10:13:47AM +0200, Rafael Garcia-Suarez wrote:
> > On 6/5/05, Dave Mitchell <[EMAIL PROTECTED]> wrote:
> > > Can't really be fixed short of using some other static SV to mark unused
> > > elements (cf PL_sv_placeholder), but personally I think that's throwing
> > > good money after bad.
> > 
> > I agree with this. exists() on arrays seems to be a bit useless to me,
> > or not well-defined, and I'm not in favor of sacrifying array
> > performance to make it work. Moreover testing (@_ >= 1) can already be
> > used to count number of arguments (to refer to the OP's problem.)
> 
> How do you feel about this:
> 
> --- perl/av.c.orig      2005-06-02 01:07:41.000000000 -0700
> +++ perl/av.c   2005-06-06 02:05:04.853572800 -0700
> @@ -927,8 +927,8 @@ Perl_av_exists(pTHX_ AV *av, I32 key)
>             return FALSE;
>      }
>  
> -    if (key <= AvFILLp(av) && AvARRAY(av)[key] != &PL_sv_undef
> -       && AvARRAY(av)[key])
> +    if (key <= AvFILLp(av) && AvARRAY(av)[key]
> +        && (AvARRAY(av)[key] != &PL_sv_undef || ! AvREAL(av)))

Could I get an extra set of parens somewhere here. It always feels icky to
see a mixture of && and || in a line for a simple regex. If not only to
prevent compilers that treat && and || exactly the same precedence

>      {
>         return TRUE;
>      }
> 
> which should make exists true for any parameter actually passed, so
> long as @_ isn't reified.


-- 
H.Merijn Brand        Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using Perl 5.6.2, 5.8.0, 5.8.5, & 5.9.2  on HP-UX 10.20, 11.00 & 11.11,
 AIX 4.3 & 5.2, SuSE 9.2 & 9.3, and Cygwin. http://www.cmve.net/~merijn
Smoking perl: http://www.test-smoke.org,    perl QA: http://qa.perl.org
 reports  to: [EMAIL PROTECTED],                perl-qa@perl.org

Reply via email to