Lately I've been furiously modifying my main work project codebase, 
going through old (old!) code bits and reworking where I could, to 
modernize (i.e. take advantage of functions/tags that didn't exist back 
in the day) and/or just increase efficiency. I fully expect my keyboard 
to just say "I've had enough" and commit suicide any time now.

One of the things I've been dealing with is my past slackness re: 
variables and scopes, and the crossing of scopes. I've been tossing in 
Duplicate() around many scope/var bits when, say, setting a particular 
variable in an application scoped structure to equal an unscoped var, or 
a session scoped var.

The idea behind that is (and I'm sure I'm not telling anyone anything 
they don't know) is that a straight up "application.var = session.var" 
just creates a reference, and doesn't copy by value.

So - when running a particular script that uses variables in the 
app/session scopes, for example, is it all that crucial when going the 
other way? Is going with "variables.var = application.var" a bad thing, 
considering that application var is *not* likely to go away anytime 
soon? Or is it best practice to still copy by value?

In such a scenario, should that app scope var change in mid-stream for 
whatever reason (unlikely), I assume the variables scope var, being a 
reference, would reflect that change.

Assuming there's zero risk of said app scope var changing/vanishing over 
the execution time of the script, wouldn't the copy-by-reference be just 
a smidge less of a resource usage than copying by value?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353544
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to