Damian in PBP says to do so, using Readonly to enforce the constancy of it. I don't agree - I prefer constant, but that's because I do most of my code in an OO fashion where "use constant" creates an inheritable method for me and export only in rare circumstances. As for auto-converting "use constant" into Readonly variables for some other module ... it's violating the API of the module. I would do that only if it's broken, not because I don't like it.
Of course, you could just define your own wrapper around the offender ...
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
| [reply] |