Semantics aside, the reason I stopped using isDefined() is because it
was flaky, and returned false positives sometimes.

One could have code like this:

<cfif isDefined("session.foo")>
    <cfoutput>#session.foo#</cfoutput>
</cfif>

And it *could* error, saying session.foo doesn't exist.  Note, this was
in a closed test environment, running one browser instance on one
machine with only me testing it: no possibility of race conditions, no
chance anything else was running other than the current request.
Putting debug code BEFORE the <cfif> indeed demonstrated the variable
actually DID NOT exist.

It did not happen all the time (obviously), only seemed to affect the
session scope, and was acknowledged by Macromedia @ the time.  Whoever
I was talking to there suggested structKeyExists() would not have the
problem, ever, and indeed I've never had said problem again.

It might be (should have been!) fixed since - this conversation was
back on CFMX6.1 - but it was enough to leave a bad taste in my mouth
regarding isDefined(), and structKeyExists() almost always can be used
in its place, so that's what I now use.

isDefined() also has that stupid hang-up about "properly-formed
variable names" (underscores, letters, numbers, unicode currency signs,
starts with underscore or a letter, etc), which has not actually been a
limitation in CF since CFMX6.  It's like they're not bothering to
maintain it any more..?

-- 
Adam


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to