develooper Front page | perl.perl5.porters | Postings from February 2000

Re: [PATCH 5.5.660] improved semantics for assign to pseudohash

From:
Michael G Schwern
Date:
February 28, 2000 15:31
Subject:
Re: [PATCH 5.5.660] improved semantics for assign to pseudohash
Message ID:
20000228183120.A27419@athens.aocn.com
On Mon, Feb 28, 2000 at 09:32:33AM -0500, John Tobey wrote:
> Run "perl -MO=Terse -e '%x=()'" or "perl -Dx -ce '%x=()'" to see the
> tree structure we're stepping around in.

Ooooh, B::Terse.  I'll have to remember that.  Much more readable than
-Dx.  Thanks.

As long as I'm asking, is there an equivalent to Data::Dumper for C
debugging?  I find myself wanting to inspect the internals of SVs and
AVs, but all the inspection stuff is macros.


> Hmmm.  By using a single flag (OPf_SPECIAL) in the AASSIGN op, we lose
> the chance to specify for each child on the left-hand side whether it
> uses the hash syntax or not.

No, its okay.  OPf_SPECIAL is correctly only set on pseudohashes and
hashes.  Arrays and scalars don't get flagged since only OP_RV2HV and
OP_PADHV get hit.  I've verified this.


> I don't know how relem got to be 'whatever', but the fact $extra[0]
> survives is consistent with your change in Perl_ck_aassign().

That's what I thought, but its not.  OPf_SPECIAL is not set on the op
and @extra is properly treated as an array in aassign().


> > In 28 %$avhv is getting completely cleared.
> 
> I would expect @extra to keep its first element here, too.  Does it?
> If not, is OPf_SPECIAL actually set?

%$avhv has OPf_SPECIAL set on it, @extra does not, as expected.
@extra is properly handled by aassign, nothing odd hangs around.  The
problem is that %$avhv is completely empty by the time it reaches
aassign, which makes me think its being optimized somehow and that
optimization is not aware that its a pseudohash.  The odd part is that
av_clear() is not called (before aassign).  This is going to be hard
to track down without divine intervention.


-- 

Michael G Schwern      http://www.pobox.com/~schwern/      schwern@pobox.com
But folks don't get me wrong.   Jews are not antichrists.  Only Karl Marx was for he has created communism.
             --Alex Chiu, Immortality Guy



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