Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re^2: const correctness

by amarquis (Curate)
on May 14, 2008 at 14:00 UTC ( #686517=note: print w/replies, xml ) Need Help??

in reply to Re: const correctness
in thread const correctness

When first I learned programming in a formal environment (first computer science classes), I was very concerned about properly noting my "never to be changed" variables to the compiler. When I got to Perl, it was one of the first things I looked for, but was confused by the differences between and the possible subtle traps within Readonly and constant. So, I stopped using them, even though it bothered me to do so.

And today my own thoughts are more in line with your point number two. My own code makes obvious what should not be changed internally, and the external interface protects/hides everything from outside code. I like giving myself as much protection against myself as possible (strict, warnings, etc.), but now feel like const would be redundant with the checks implicit in the way I code.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2022-08-08 19:56 GMT
Find Nodes?
    Voting Booth?

    No recent polls found