in reply to RE: RE: Re: Dreaming of Post Interpolation (*)
in thread Dreaming of Post Interpolation

Hmm. Seems to me that this could be done with a fancy Tie somehow. Not quite as you have posted it though....Perhaps if $m, $o, and $s were also cascaded...
How far would you want this to go? While the above example could be done, I can see it getting messy with subroutine calls. For example:
$n=1; #we have no idea which variables should be cascaded. $subref=sub { return $n *3 }; print &$subref, "\n"; $n=2; print &$subref, "\n";
Will that output
3
6
?.
Stream of conciousness: the Monitor package uses a tie on a variable to track when a variable is changed...can we track when it is accessed, and turn on cascading for any lvalue, etc? (I see dire consequences on the stack/heap, but...) Then when any such value is modified, you could go through the cascade stack and reset every value. It would go nuts on code like:
use Cascade; cascade $n; cascade $m; $n=1; $m=$n; $n=$m+1;
Because $m is altered by $n, and thus when we change $n, we recalc $m, which is in turn set by $n, so we recalc....

But I guess this isn't much different from screwing your reference count by doing a $a=\$a (except of course that that doesn't hang).

All speculation anyway, since I don't believe that there is any way to find what lvalue is affected by a variable reference.