i was wondering what you meant by "an opaque representation of the object's internal state"
;) great discussion! although i have to say that the example of the clone function wouldn't work in all cases. if an object's functionality depends on it's "ethereal state", then you'd need more than variables.my or variables.instance. so maybe a getClone() and setClone() in the object you'd want to be able to clone would be needed that returns and accepts the whole variables struct within an object. ? > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Behalf Of Barney Boisvert > Sent: Monday, September 26, 2005 9:32 PM > To: [email protected] > Subject: Re: [CFCDev] CFC Assignment Query > > > While I'm at it, I should mention that I store my object state in a > very specific way: > > 'this' contains immutable constants (even though CF doesn't have > such a concept) > 'variables' contains ethereal state (like caches) > 'variables.my' contains "real" state > > 'variables.instance' seems to be a more common name for > 'variables.my', but I got into the habit of calling instance variables > "my" long ago (before I started doing CF), and the convention has > stuck. > > Creating a memento for such an object is as simple as duplicating the > 'variables.my' struct. That's not opaque, of course, but it is an > encapsulated representation of the object's state, which is really > what you're looking for. If you want it to be opaque, you could > serialize it and encrypt it, but if you ask me, that's way overkill. > > cheers, > banreyb > > On 9/26/05, Ryan Guill <[EMAIL PROTECTED]> wrote: > > alright, i follow you... > > > > hmmm > > > > On 9/26/05, Barney Boisvert <[EMAIL PROTECTED]> wrote: > > > Not native to CF. Implementing a 'clone' method is pretty > trivial though: > > > > > > function clone() { > > > var newObj = createObject("component", getMetaData(this).name); > > > newObj.setMemento(getMemento()); > > > return newObj; > > > } > > > > > > Where getMemento and setMemento return and accept an opaque > > > representation of the object's internal state. > > > > > > cheers, > > > barneyb > > > > > -- > Barney Boisvert > [EMAIL PROTECTED] > 360.319.6145 > http://www.barneyb.com/ > > Got Gmail? I have 100 invites. > > > ---------------------------------------------------------- > You are subscribed to cfcdev. To unsubscribe, send an email to > [email protected] with the words 'unsubscribe cfcdev' as the > subject of the email. > > CFCDev is run by CFCZone (www.cfczone.org) and supported by > CFXHosting (www.cfxhosting.com). > > CFCDev is supported by New Atlanta, makers of BlueDragon > http://www.newatlanta.com/products/bluedragon/index.cfm > > 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' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). CFCDev is supported by New Atlanta, makers of BlueDragon http://www.newatlanta.com/products/bluedragon/index.cfm An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
