Clear questions and runnable code
get the best and fastest answer
Re: When do you include the usual use pragmas in your example code?by rjt (Deacon)
|on Aug 04, 2013 at 02:54 UTC||Need Help??|
Excellent replies. (Keep 'em coming!) I'll bundle up a few replies to keep the page size down:
hippo: It's an interesting concern and should probably remain up to the whim of the individual poster,
I agree completely. Once in a while, my individual whim benefits from a little collective influence such as this.
toolic: Regarding the signature, some monks (like me) disable it because it is a distraction from the rest of the post, but we are probably in the minority.
I hadn't considered that. It's probably a pretty good bet that any monk PM-savvy enough (and active enough to care) to use custom CSS to hide pmsig blocks already knows a thing or ten about strictures and warnings (i.e., not part of the target demographic). From a continuity standpoint, though, probably best, then, not to rely on a post making sense iff the signature is visible.
davido on Dominus: If I do advocate for the use of strictures and warnings, I'll also try to point out which aspect of "strict" would have caught some problem in the user's code, or which warning might have been raised had warnings been enabled.
I do like that much better than the blanket "use strict;" 2x4 some monks wield (and I've no doubt taken a swing or two myself with).
BrowserUk: Insisting that every snippet posted is a complete, stand-alone, pedant-compliant work of dogma; is like insisting on a full salt-throwing ritual before demonstrating tying a nappy on a doll. Ie. Meaningless overkill.
I think your analogy itself may have been meaningless overkill, but that won't get in the way of me agreeing with your overall sentiment. :-)
BrowserUk: Perhaps the only thing sillier is worrying about it :)
Perhaps. I could say I see it more as "optimizing" than "worrying", but then I could be rightly accused of worrying about semantics.
moritz: And newcomers already have enough to struggle with, I don't want to increase their cognitive load by using a convenience subroutine that then makes their live harder.
This ↑ ↑ ↑ is the whole point I was dancing around, I think: i.e., minimizing cognitive load. Well said.
So, where does that leave me? There's still some room for me to be swayed, but what I take away from these replies (colored a bit by my own preferences of course) is that it makes sense to ditch the boilerplate unless it's relevant, but including any pragmas required to successfully run the code (i.e., use 5.010; in examples with say) is still worth it.
Again, thank you all for the most thoughtful replies. Yes, even you, Anonymonk. Please keep them coming, that is, if there's anything more to say.