Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
The pain of writing code to support the pragma may well be more than the pain saved by the compile time checking.

Oh, I would agree with that. I personally would not use said pragmas. Then again, I don't even always use strict (though I do use it in include files and in large, complex programs, and I would certainly use it in a module). However, there are some people whose mindset just tends to prefer a lot of strict rules. People who prefer Pascal over BASIC, if you can imagine. People who use strict and warnings even for one-liners and obfuscations. Those people would probably appreciate the ability to force all subs to be predefined, for example. Of course, if they really want it, one of them would have to step forward and implement it, but what I was saying is that if it's done as a pragma, we needn't object, because all you have to do to be free of it is not bother to use the pragma.

That said, I'm not sure what the bondage pragma would do. Perhaps require all control structures to have a single entry and a single exit point (so, no next or last permitted, to say nothing of early returns), I suppose. I imagine the discipline pragma might prohibit subroutines from accessing any variables not lexically scoped within the subroutine, so that any external variables would have to be passed in as arguments to be used, and if they were to be changed the results would have to be passed back out as a return value and applied by the calling code. I'm not sure what use pain would do, exactly, but I suppose it would be even worse than discipline.

The really neat thing about these pragmas, if they existed, would be that we could say, "C gives you enough rope to hang yourself, but Perl gives you enough rope to tie yourself up."


$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/

In reply to Re: When -w and use strict aren't enough... by jonadab
in thread When -w and use strict aren't enough... by RMGir

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 scrutinizing the Monastery: (6)
As of 2024-03-28 15:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found