in reply to Re^8: Changing array by changing $_?
in thread Changing array by changing $_?
OK, the penny is dropping...
So the @_ is an array of SV*. To distinguish aliases as arguments requires the pointer, not the target, to be marked -- it's only assignments via the alias that should be trapped. That would add overhead.
Mind you, the compiler knows when it's assigning to $_[x], and only then does it need to worry about copies of aliases -- I think the propagation of aliases is limited -- so I guess the overhead could be contained... assuming one could figure out a way of passing the information with the pointer. Hmmm. I'm starting to feel queasy.
Well, nothing's perfect... if the 99% cases (lexically inside the foreach/map/etc) were trapped at compile-time it would be a step in the right direction.
|
|---|