I ran across this same behavior, and I was told it was "By Design" when I asked about it. When you create on object by institating(sp?) a CFC, new variable value pairs can be added to this object's unnamed scope pragmatically, just as they can be added to any other scope in ColdFusion (session.t=6 for example). So the statement myobj.t = 6 will create a variable in the object and give it a value. You can even write a function that will use the value, if you like.
I thought this was rather unusual myself and I don't know if it can be prevented or not. -------------- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Friday, September 19, 2003 2:34 PM > To: [EMAIL PROTECTED] > Subject: [CFCDev] setting cfc vars etc not defined in a cfc? > > > Ok, playing around with stuff this afternoon. I created an > 'empty' cfc named test.cfc, its empty for no good reason just > a proof of concept > <cfcomponent> > > <!--- empty ---> > > </cfcomponent> > > Now I created test.cfm > <cfscript> > > myobj = CreateObject("Component", "test"); > myobj.t=6; > WriteOutput('t= ' & myobj.t); > </cfscript> > > When I call test.cfm from ze browser I get no error. In fact > I get t= 6 output to the browser. Now in Java, etc... this > would bomb out. How can I programatically keep this from > occuring? Or can I? Am I missing something here? > > Doug > > ---->dugOUT ��� > "When I was kidnapped, my parents snapped into action. They > rented out my room." -- Woody Allen > > ---------------------------------------------------------- > 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]
