You don't need the duplicate() call in that case anyway, since you just create a new struct on each iteration of the loop. As was pointed out earlier in this thread, you are only making the reference to a given variable safe with "var" -- so you only need to use "var" to declare the variable names you are going to use. Since you'll need to have some kind of variable name to refer to your nested structures, the only overhead from a coding standpoint is needing to declare those names up-front.
What am I missing about why it's a problem? > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Behalf Of Matt Liotta > Sent: Tuesday, February 10, 2004 5:15 PM > To: [EMAIL PROTECTED] > Subject: Re: [CFCDev] How should I define variable in a CFC? > > > It would handle it just fine, but your Duplicate() call is expensive. > Also, having additional nested structs makes things quite messy indeed. > > -Matt > > > On Feb 10, 2004, at 6:12 PM, Raymond Camden wrote: > > > I'm late to this thread, but what is wrong with this: > > > > <cffunction ....> > > <cfset var tempStruct = ""> > > <cfset var data = arrayNew(1)> > > <cfset var x = 1> > > > > <cfloop index="x" from=1 to=10> > > <cfset tempStruct = structNew()> > > <cfset tempStruct.foo = "moo"> > > <cfset arrayAppend(data,duplicate(tempStruct))> > > </cfloop> > > > > Won't this handle it just fine? > > ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the words '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]
