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??

I've no problem with ref $this || $this either, but there is absolutely no consensus in the Perl community regarding expected behavior when a constructor is called on an instance. (Maybe nethack should get launched.) That's the real problem with that construct. If the programmer puts it in the code, he or she should understand why it's being put in and document it. Otherwise, why bother writing it?

Update: Now that I think about it, using this without documentation is even more problematic with an abstract base class. If I'm subclassing a module, I'm tightly coupling my subclasses behavior with that of my superclass(es). It's even more important that I understand the behavior of those classes with such coupling, therefore I would be even more inclined to ding someone for ref $proto || $proto unless that person had clear documentation. If it's not documented, it's not a contract with those who use the class and, as such, cannot be defined behavior. Using undefined behavior is a Bad Thing and subclasses should be especially vigilant not to do this (not that I would excuse this in everyday code, either.)

Cheers,
Ovid

New address of my CGI Course.


In reply to Re^2: Abstract Packages by Ovid
in thread Abstract Packages by Velaki

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 cooling their heels in the Monastery: (6)
As of 2024-04-25 08:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found