Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.


In reply to RE: RE: RE: Re: Dreaming of Post Interpolation by swiftone
in thread Dreaming of Post Interpolation by BBQ

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2024-03-29 00:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found