Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
The ref $proto || $proto idiom is not bad in and of itself. It's bad when it's tossed in around blindly without documentation because it suggests that perhaps the programmer is unaware of the intention.

But that implies that people will read said documenation and even more so that if they read it, they would understand it. That can be a heavy assumption. Of course, it could be argued that if they don't read it, it's their problem anyway.

Personally, I tend to be a paranoid programmer, and I am very concerned about my modules working as I intend and sending feeback/warnings/errors back to the user if they are not used correctly, regardless of the documenation.

As with anything in Perl (or even life), I would hate to automatically declare anything wholly without merit (with the possible exception of bell peppers -- they're just gross), so I'd argue that this idiom has it's place so long as someone knows why they've put it there.

I guess I am not arguing so much that the idiom is bad, but that maybe teaching it soooooo widely is. I know that I use it, and have never really stopped to consider the implications of it being misused (I mean, all the cooool kids use it ;-) . So yes, I am one of those people who didn't stop to think about why I put it there, but I am sure I am not alone. And I am also sure there are many new perl programmers, who will make the same mistake. When will the madness end!!!!!!

Of course, in the interest of full disclosure, I'm the guy who submitted the patch that had the ref $proto || $proto code mostly removed from the latest perldocs.

Excellent! Did the patch get accepted?

-stvn

In reply to Re^2: Is "ref($class) || $class" a bad thing? by stvn
in thread Is "ref($class) || $class" a bad thing? by stvn

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 making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-25 22:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found