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

pp_list in list context

Thread Next
From:
Steffen Mueller
Date:
February 20, 2014 17:52
Subject:
pp_list in list context
Message ID:
530640C3.7060000@cpan.org
Hi all,

Looking at the code for pp_list[1], does an OP_LIST have any use in list 
context? Or could it always safely be compiled out of the op_next chain[2]?

Best regards,
Steffen

[1]
PP(pp_list)
{
     dVAR; dSP; dMARK;
     if (GIMME != G_ARRAY) {
	if (++MARK <= SP)
	    *MARK = *SP;		/* unwanted list, return last item */
	else
	    *MARK = &PL_sv_undef;
	SP = MARK;
     }
     RETURN;
}



[2] perl -MO=Concise -e '$x = @h{(1, 2)}'
d  <@> leave[1 ref] vKP/REFC ->(end)
1     <0> enter ->2
2     <;> nextstate(main 1 -e:1) v:{ ->3
c     <2> sassign vKS/2 ->d
a        <@> hslice sK ->b
3           <0> pushmark s ->4
7           <@> list lKP ->8
4              <0> pushmark s ->5
5              <$> const[IV 1] s ->6
6              <$> const[IV 2] s ->7
9           <1> rv2hv[t3] sKR/1 ->a
8              <#> gv[*h] s ->9
-        <1> ex-rv2sv sKRM*/1 ->c
b           <#> gvsv[*x] s ->c
-e syntax OK

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