develooper Front page | perl.perl5.porters | Postings from October 2005

Re: [PATCH] Re: [perl #37350] $#{@$aref} in debugger gives: Bizarre copy of ARRAY in leave

Thread Previous | Thread Next
From:
Yitzchak Scott-Thoennes
Date:
October 12, 2005 02:18
Subject:
Re: [PATCH] Re: [perl #37350] $#{@$aref} in debugger gives: Bizarre copy of ARRAY in leave
Message ID:
20051012091812.GB3004@efn.org
On Tue, Oct 11, 2005 at 11:15:49PM +0100, Robin Houston wrote:
> David Landgren wrote:
> > That's because perl is trying to do the right thing with bad syntax.
> 
> Well yes, but that's still a bug because perl ought to reject bad
> syntax! The reason it isn't rejected is that pp_rv2av will happily
> accept an AV on the stack, in lieu of an actual reference. That
> can't be changed in general, since it's relied on.

I think the problem is that that the first executed (of two) rv2av is
getting the OPf_REF flag set, when IMO it shouldn't.  $#{@x} *is*
valid syntax; it should return $# of the array symbolically referred
to by @x, like this:

$ perl -we'*1 = [qw/foo bar baz/]; @x=0; print $#{0+@x}'
2

only without the 0+ being there.  (If @x is lexical, then it's padav
that has the troublesome OPf_REF.)

Thread Previous | Thread Next


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