I know the cfproperty tag only creates metadata - I probably shouldn't even be using it since I would like to keep all of my instance properties private.
Well, cfproperty has nothing to do with public / private either so, no, unless you are building Web Services and *need* cfproperty for validation purposes, you shouldn't be using it.
There was a point raised in an earlier debate regarding whether the pseudo-constructor area would remain in subsequent versions of CF;
Whilst I can't speak for the CF product team, I think the emphasis on backward compatibility in each release would make it hard for them to remove the pseudo-constructor area...
Since I'm not creating my internal properties with the "var" keyword
"var" is for local variables, not instance data.
I _always_ init() my objects
So your usage scenario is:
<!--- create instance --->
<cfset x = createObject("component","mycfc")>
<!--- init the instance --->
<cfset x.init()>
<!--- use the instance multiple times --->
<cfset x.setFoo(42)>
<cfset y = x.getFoo()>why is it that the variables are lost from function to function?
Are you doing this:
<cfinvoke component="mycfc" method="setFoo">
If so, that creates a *new* instance each time.
I was under the impression that the variables in the unnamed scope, if not created with "var," persist inside the component.
They do.
Apparently, I'm wrong
Your assumptions are correct - I suspect your usage of the component is wrong.
Sean A Corfield -- http://www.corfield.org/blog/
"If you're not annoying somebody, you're not really alive." -- Margaret Atwood
----------------------------------------------------------
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).
