Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Those are valid concerns, at least in the context of a one-off implementation. If you think of it as (say) an additional feature of Class::Std, the choice of the "representative attribute" would be abstract (probably the first, or last, attribute declared in the class) and rather obvious. The ugliness would be hidden in the general destructor.

Come to think of it, there's a problem with classes that don't have (their own) object attributes, but still want destructible class data. Normal garbage collection would likely ignore such a class, so it can't be used as a trigger. You'd need a dummy attribute or some such.

Your more intricate first implementation would still work, if only because the class attributes are implemented as object attributes, so the case doesn't arise.

Unrelatedly, I think your writeup would be easier to read if you swapped the two implementations, so the simple one comes first and can serve as an introduction.

Anno


In reply to Re^3: Garbage collected class attributes with inside out classes. by Anno
in thread Garbage collected class attributes with inside out classes. by kyle

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 examining the Monastery: (2)
As of 2024-04-26 02:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found