-
Notifications
You must be signed in to change notification settings - Fork 589
Open
Labels
Description
Description
In scalar context, a (possibly-nulled) LIST
OP may effectively contain a single item.
It seems like this container OP and redundant KID OPs could be removed entirely.
For example, my $x = (1,2,3)
leaves Perl_scalar
as:
2 <;> nextstate(main 2 -e:1) v:%,us,{,fea=15 ->3
7 <2> sassign vKS/2 ->8
5 <@> list sKP ->6
3 <0> pushmark v ->4
- <0> ex-const v ->-
- <0> ex-const v ->4
4 <$> const[IV 3] s ->5
6 <0> padsv[$x:2,3] sRM*/LVINTRO ->7
Could this be optimised to:
2 <;> nextstate(main 2 -e:1) v:%,us,{,fea=15 ->3
5 <2> sassign vKS/2 ->6
3 <$> const[IV 3] s ->4
4 <0> padsv[$x:2,3] sRM*/LVINTRO ->5
See also #23447.
Steps to Reproduce
perl -MO=Concise -E 'my $x = (1,2,3)'
Perl configuration
5.43.0 and previous.