Andrew,

 

What are you on about, you haven't contributed at all except to confuse the
issue.

 

Variables is not specific to CFC's which was my point to Marks comment

You can't accesss local function variables unless you put them into a scope

 

Regards

Dale Fraser

 

 <http://dalefraser.blogspot.com> http://dalefraser.blogspot.com

 

 

From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Andrew Scott
Sent: Tuesday, 3 July 2007 4:37 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: Function local variables scope

 

Which is why it is BEST PRACTICE to scope your variables...

 

Not to mention a small speed increase in performance, as marginal as it is.



Andrew Scott
Senior Coldfusion Developer
Aegeon Pty. Ltd.
www.aegeon.com.au
Phone: +613  8676 4223
Mobile: 0404 998 273

 

 

From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Dale Fraser
Sent: Tuesday, 3 July 2007 4:35 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: Function local variables scope

 

To further clarify why you should use local = structNew().

 

If you have a function that sets variable x

 

And you forget to declare x as var

 

Then when you

 

<cfset x = 10 />

 

In a function, you are actually setting variables.x which is overriding the
instance variable X if it existed.

 

Regards

Dale Fraser

 

http://dalefraser.blogspot.com

 

 

From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Dale Fraser
Sent: Tuesday, 3 July 2007 4:25 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: Function local variables scope

 

No it's not variables.

 

variables is CFC private

this is CFC public

 

Here's what you should do

 

<cffunction ....>

 

     <cfset var local = structNew() />

 

     <cfloop index="local.i" from="1" to="10">

           ...

 

     <cfset local.another = "Hello" />

 

This way 

 

1.  You can dump them

2.  You can not forget to var them thus they are all private.

 

Regards

Dale Fraser

 

http://dalefraser.blogspot.com

 

 

From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of AJ Mercer
Sent: Tuesday, 3 July 2007 4:08 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: Function local variables scope

 

is it VARIABLES
or is that something completely different?

On 7/3/07, Chris Velevitch <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:


On 7/3/07, Dale Fraser <[EMAIL PROTECTED] > wrote:
>
> There is no local scope, what are you referring to.

I'm inside a function and I want to cfdump the functions local scope.



Chris
--
Chris Velevitch
Manager - Sydney Flash Platform Developers Group 
m: 0415 469 095
www.flashdev.org.au




-- 
If you are not living on the edge,
You are taking up too much space.

 

 

 

 

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.476 / Virus Database: 269.9.14/884 - Release Date: 2/07/2007
3:35 PM



 

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.476 / Virus Database: 269.9.14/884 - Release Date: 2/07/2007
3:35 PM

 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to