Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: Why this simple code doesn't work?

by CountZero (Bishop)
on Mar 02, 2012 at 18:06 UTC ( #957524=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Why this simple code doesn't work?
in thread Why this simple code doesn't work?

I totally agree that when following my advice the script will break. And for good reasons, since there is no good reason why you want to "re-cycle" a built-in keyword and then you can only make your bad choice of a sub-routine name work by using a construct that has an unwanted (and I am quite sure, unknown to the OP) side-effect.

I think my "standard response" to using prototypes and the calling of subs with "&" is correct. Someone adds a wrong prototype to the sub-definition (I repeat, probably blissfully unaware of what he did) and then you need to set aside the prototype to make it work. Please, explain to me the merit of this kind of programming.

In Perl 4 you had to prepend "&" to the sub-name to call it. In Perl 5 the meaning of "&" has totally changed.

And I challenge you to proof that adding "&" to all your sub-calls is not silly. Some subs that work like built-ins need the prototyping to work.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics


Comment on Re^3: Why this simple code doesn't work?
Select or Download Code
Re^4: Why this simple code doesn't work?
by JavaFan (Canon) on Mar 02, 2012 at 20:24 UTC
    It's funny that you first totally ignored the, what you call, "re-use" of a keyword, and only when pointed out that the "saving of a keystroke" actually breaks you come with "yeah, but you shouldn't reuse a keyword".

    It's ever funnier that you first make a big deal about prototypes, and that you shouldn't use them, and then keep saying that the use of & circumvents them.

    And that while none of them contributed a single iota to solving the problem the OP had.

      It pleases me a lot that my funny remarks brought a smile upon your face! :)

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      My blog: Imperial Deltronics

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://957524]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2014-10-01 11:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (9 votes), past polls