This is kind of off topic - but be aware that it seems (STRESS - SEEMS) that duplicate is still broken. Rob Brooks-Bilson found an issue w/ it and COM objects, which doesn't apply here, but I thought I'd share. (And if it ends up being confirmed, then I'll vote for duplicate as being the most cursed function in CF history.)
For more info, see my blog posting. Raymond Camden > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Nathan Dintenfass > Sent: Friday, April 02, 2004 10:25 AM > To: [EMAIL PROTECTED] > Subject: RE: [CFCDev] Protecting private Array variables using get/set > > First off, the array itself should copy by value, not by > reference (only structs, queries, and objects copy by reference). > > However, if you had, say, an array of structures or a > structure in the variables scope of a CFC you might still run > into this. > > The function you are looking for is duplicate() (which should > almost always be used instead of structCopy anyway because it > does a "deep" copy) -- if you use it, be sure to apply the > hotfix for 6.1 that addresses duplicate(). > > Others may disagree, but I would say it's not a bad idea at > all to use arrays (or structs or queries for that matter) to > hold "private" instance data. > > - Nathan > > > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Behalf Of John Temm > > Sent: Friday, April 02, 2004 8:12 AM > > To: [EMAIL PROTECTED] > > Subject: [CFCDev] Protecting private Array variables using get/set > > > > > > Hi > > I have a CFC with a property "varaiables.permissions" that > is an array > > of permission objects. I have built methods to add and remove > > permission objects to/from this array which enforce the > 'type' of the > > array, and a 'getter' which returns the whole array. The problem I > > have is that since getPermissions() returns a reference to > > varaiables.permissions, not a copy, a developer could skirt my > > addPermission method and insert say, a string into my typed > array. I > > don't see an ArrayCopy native function (akin to StructCopy). The > > arrays are generally very small so creating a copy with a > loop won't > > be a big performance hit, but... it's ugly. > > > > Ideas? Is it generally not a good idea to use arrays for properties > > because of this? > > -Chip Temm > > [EMAIL PROTECTED] > > ---------------------------------------------------------- > 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] > ---------------------------------------------------------- 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]
