Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Constant names come into conflict with Perl style?

by BrowserUk (Patriarch)
on Feb 07, 2007 at 21:15 UTC ( [id://598886]=note: print w/replies, xml ) Need Help??


in reply to Constant names come into conflict with Perl style?

There is nothing that says that your constant subs have to have all upper case names.

My personal preference has evolved to be mixed case names starting with an upper case letter. This avoids the conflict you describe, and (in my schema), distinguishes constant subs from other subs which are mixed case but start with a lower case letter.

I also find it infinitely preferable to so called Readonly variables--which is just a nonsense IMO. (Ie. variables that don't). Constant subs also allow Perl to perform optimisations that are not possible with 'Readonly variables'; and they don't carry that modules overheads.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re: Constant names come into conflict with Perl style?

Replies are listed 'Best First'.
Re^2: Constant names come into conflict with Perl style?
by dmitri (Priest) on Feb 07, 2007 at 21:39 UTC
    "There is nothing that says that your constant subs have to have all upper case names."

    That's true, there's nothing that says it, but if you grep your /usr/lib/perl5 for 'use constant', you will see that the overwhelming majority of constant names are upper-case.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-04-26 05:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found