Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

RE: RE: RE: Re: Dreaming of Post Interpolation

by swiftone (Curate)
on May 30, 2000 at 21:57 UTC ( [id://15461]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://15461]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-18 22:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found