in reply to Re^5: Autovivifying XS routine
in thread Autovivifying XS routine

...peek at want.xs shows an aweful lot of logic

Right. I disentangled the part that I'd need and ended up with (almost) half the code from Want.xs. Speed issues aside, that's not reasonable.

what happens if someone assigns the return from gimme_a_ref() to a scalar, and then attempts to dereference it later?

That would be no different from other autovivifying situations. You can say

my $x; $x->{hihi}->{haha} = 'hoho';
but you can't keep $x->{hihi} for later, as in
my $x; my $y = $x->{hihi}; $y->{haha} = 'hoho';
So I'm not worried much about that effect, but the autovivifying option is out for the reason above.

Alter is already using ..., two levels of inside-out-style dereferencing

It's not quite as bad. Alter::ego is one hash access slower than the inside-out equivalent Hash::Util::refaddr. That's the difference that matters afaik, otherwise they do about the same amount of almost nothing.

Anno