D:\tmp\pm>perl -MO=Concise,TST::foo -e"package TST; our $xxx=666; sub
+foo { print $xxx}"
TST::foo:
5 <1> leavesub[1 ref] K/REFC,1 ->(end)
- <@> lineseq KP ->5
1 <;> nextstate(TST 3 -e:1) v ->2
4 <@> print sK ->5
2 <0> pushmark s ->3
- <1> ex-rv2sv sK/1 ->4
3 <#> gvsv[*TST::xxx] s ->4
-e syntax OK
while illguts° states
Lexicals (my and our variables) have SVs_PADMY / SVs_PADOUR
My experiments show that deleting the stash entry prior to running the code doesn't effect the correct execution. Hence I think that the refs are hardcoded (bound) into the op-tree and STASHs and PADs are primarly for lookup at compilation time. (plus ref-counting)
My experiments also showed that deleting the alias of an 'our'-var from the STASH forced a destruction of that var at the end of the scope, much like with 'my'-vars.
So I'm inclined to think that Concise is just showing an interpretation of the refadress in the optree.
Anyway all this confusion stems from fuzzy wording.
We should stop referring to private my-vars as "lexicals".
A distinction between "private" and "public" would be far better.
"lexical" should be reserved for the scope only and contrasted with "dynamic" ²
Consequence: an our-var is a "lexical and public" variable.
NB: I'm also contrasting "public" from "global", because only special vars like $_, $| or $a are really global, they always belong to main::
°) "Illustrated Perl-Guts" ... is it only me, or does "illguts" make you think of diarrhea?
update
²) in hindsight, lets avoid "lexical scope" and rather use the synonymous "static scope" |