The problem really comes to light when you're dealing with a high-traffic
site.  In my previous example, if multiple requests were using the component
in a persistent scope (like Application.myCFC or whatever) it would cause
problems if more than one request happened to get into that
<cfcatch></cfcatch> simultaneously.  Without 'var' scoping the cfcatch
structure, I'm running a really good possibility that one request will get
the cfcatch structure generated by someone else.

This is one more reason not to use CFCs for anything more than a code
organization tool for a procedural system.  I can't help but think that it
was slapped together by Macromedia as an after-thought.

 - j.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Dave Watts
Sent: Thursday, November 06, 2003 11:39 AM
To: '[EMAIL PROTECTED]'
Subject: RE: [CFCDev] Native CF tags and local scope


> I get an ear-full all the time to var scope every variable
> that is created inside the CFC. Now I hear that's not the case
> and that CF tags that return structures do not need to be varred.

Well, don't just take what I say at face value anyway - Nathan just said
they do, and he's a pretty smart guy!

> Please clarify what you mean by they will go out of scope
> very quickly.

The CFQUERY scope only exists until you run another query, so you already
have to copy it into another variable if you want to avoid having it
clobbered by the next query you run. The CFCATCH scope only exists within a
CFCATCH block, and I think it's really unlikely that you'd have one CFCATCH
block clobber another, unless you invoke a component within a CFCATCH - and
even then, I'm not sure it gets clobbered anyway, although presumably it
would.

However, you probably can't go wrong by following Nathan's advice here,
since it doesn't hurt anything to create a couple more local variables.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to