Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
The purpose of this is to provide a nice interface to programmers so that they don't have to track whether the watchers need to be notified or not. Here's some actual code in the current version of my system:
onTime { our $active; our $pos : Attr('position'); if ($active) { $pos += [ 1, 1 ]; } }
(I know there's a missing 'sub' before 'onTime', but that's intentional to match our actual setup. Just pretend there is a 'sub' there.)

I would like the developers to be able to write exactly the above code, but only have the 'position' watchers notified if $pos was written to. I can do whatever setup I want in either the attribute handler or code that is inserted before the entire body, and whatever cleanup or change notification is needed at the end of the body or after the subroutine returns.

In the current system, it just unconditionally assumes that any variable that could change, did. That means there is a cost for using the Attr(...) syntax, and I want it to at least feel "free" to the developers.

Sorry if the question was unclear. It's hard to figure out how much to explain so that people can understand the question (and maybe detect if I'm asking the wrong question), and how much to leave out so people don't have to wade through irrelevant detail.


In reply to Re^2: Quickly detecting variable writes by sfink
in thread Quickly detecting variable writes by sfink

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: (4)
As of 2024-04-19 22:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found