Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^7: Burned by precedence rules (fail() if "false";)

by swampyankee (Parson)
on Dec 31, 2008 at 00:48 UTC ( #733365=note: print w/ replies, xml ) Need Help??

in reply to Re^6: Burned by precedence rules (fail() if "false";)
in thread Burned by precedence rules

No doubt it was originally defined as FOUR = 4, but then somebody was told to change it to 42 or π. This is why I tend to avoid setting constants like THREE = 3. I find it rather annoying to have constants with clear names that lie. After all, complex code is self-obfuscating; it doesn't need any help.

Information about American English usage here and here. Floating point issues? Please read this before posting. — emc

Comment on Re^7: Burned by precedence rules (fail() if "false";)
Replies are listed 'Best First'.
Re^8: Burned by precedence rules (fail() if "false";)
by gwadej (Chaplain) on Dec 31, 2008 at 04:33 UTC

    Something like that.

    This is why I started using the term magic constants a few years ago to complement magic literals. Everybody agrees that magic literals in code are a bad idea. But, what happens when the constant you chose to replace is with provides no more meaning or abstraction...magic constant.

    A constant like FOUR provides so little information that it would have been better to leave the original literal 4 in the code.

    G. Wade

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2015-12-01 02:06 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (791 votes), past polls