Couple things...

First of all, if you want to pass or dump your local variables all you
have to use is the variables scope.

<cfdump var="#variables#">

will dump all the local variables that exist at the time the cfdump is
executed... and if you want to pass them all use something like:

<cfscript>
     myVar = testMethod(variables);
</cfscript>

and your testMethod should receive a copy of all the local variables
that, again, exist at the time of the method call.

Personally I prefer to abide by and use the tools that exist within
the framework and the features of the language I'm writing in. It
seems that since CF has gone J2EE, EVERYTHING has a default scope.
While a lot of what is being said was handy and even necessary under
v. 5 and before, some of it is outmoded and only adds overhead under
the new platform.

I'll say this, however... if I have a stored procedure that returns
more than one resultset, I'll put all the resultsets in a "simulated
scope" like this:
<cfprocresult name="proc1.rs1" resultset="1">
<cfprocresult name="proc1.rs2" resultset="2">
<cfprocresult name="proc1.rs3" resultset="4">

...and for exactly the same reasons mentioned. It bundles all the data
from the sproc into a single container making passing or dumping the
data MUCH easier. Plus it adds some readability and self-documentation
to the code later... assuming that you've given your queries
appropriate and descriptive names.

I have one that returns something like 4 resultsets and all are
contained in a single container. For queries, etc, it's very handy,
and you can still use <cfoutput query="proc1.rs1">,
proc1.rs1["colName"]...

But, by and large, I prefer scoped vars prefixed, local vars implied
by lack of prefix, and as descriptive names as possible for
everything. I'll consider the idea of the single-letter prefix, but
I'm not sure I'll use it. It's intriguing, if nothing else...

Laterz! (And Happy Holidays!!)

J


-- 
Continuum Media Group LLC
Burnsville, MN 55337
http://www.web-relevant.com

On Fri, 24 Dec 2004 10:47:17 -0500, Ben Rogers <[EMAIL PROTECTED]> wrote:
> > Personally, within functions I always declare the following "phony scope":
> >
> > <cfset var local = StructNew() />
> 
> I'll second this. For awhile, I would create a local struct only if I was
> creating several variables in my function. However, over time I found that,
> if I used the local struct, I was less apt to forget to var my function
> level variables. Now, I *always* create a local scope if I have local
> variables.
> 
> Ben Rogers
> http://www.c4.net
> v.508.240.0051
> f.508.240.0057

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Silver Sponsor - RUWebby
http://www.ruwebby.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:188758
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to