> That's not strictly true. If you're never EVER going to write to the
> variable (CFSET) beyond the first write, then you can afford to not
> lock it.
True, but since READONLY locks impose just about no performance degredation
(unless an exclusive lock is in effect), why not just lock all reads AND
writes, no matter how static the variable? If it truly is a write once,
read forever type of value then a bunch of concurrent readonly locks aren't
going to do much damage.
On the other hand, if a situation ever WERE to arise where the value was
being written do, the readonly locks would kick in. Better to have the app
take a performance hit (even a small one) than risk memory corruption and
its group of buddies (pCode errors anyone?)
Finally, locking ALL access to the shared scopes helps prevent problems in
the future. For example, if your application were ever to change in such a
way that those once "constant" values become more variable in nature, if
you've made a habit of locking your reads as well as writes then you won't
have to worry. On the other hand, if you design an app with the assumption
that a given variable will never be written more than once, and then that
changes, you will have to go back through your code and add a bunch of
locks.
> Okay.. I may have overstated that. Let's say that, "Good CFML
> programming practice dictates that IT IS AN ABSOLUTE NECESITY THAT
> YOU ......"
Very well put.
> Like any good rule, if you really know what you're doing, you can
> afford to bend it from time to time.
That's true, but I still don't see how doing so has any benefits, given that
readonly locks by themselves don't really harm an application.
Best regards,
Seth Petry-Johnson
Argo Enterprise and Associates
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.