Sean,

I understand your point, but I would still expect IsDefined("thing.foo") to
return true when thing.foo = null.  It _is_ technically defined, it just
happens to have a value of null, or rather, it is not set to an instance
variable or simple type.  I think IsNull (which CF lacks) and IsDefined are
very different indeed.

Think of other languages (Java seems appropriate) that _do_ have a concept
of null.  You can compare (thing.foo == null) for a Boolean result without
generating an exception because foo does indeed exist!  Not having a value
and not being defined are two very different states.  I've always found the
behavior of IsDefined to be a bit off.

Roland Collins

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Sean A Corfield
Sent: Wednesday, February 25, 2004 10:20 PM
To: [EMAIL PROTECTED]
Subject: Re: [CFCDev] Testing For [undefined struct element]

On Feb 25, 2004, at 1:23 PM, David Ross wrote:
> Yes, this is exactly what's happening. CF has a concept of NULL
> (otherwise how would cfdump spit out "undefined struct element"), it
> just likes to throw errors before allowing you to test for it.
>
> Basically, I have arrived at if structkeyExists() == true and assigning
> the value into a dummy var errors, then it's null. Talk about
> overhead...

Hmm, that doesn't really make sense to me. If thing.foo is null then 
isDefined("thing.foo") should be *false* even tho' 
structKeyExists(thing,"foo") is true. Can you show a reproducible 
example of what you're seeing?

Regards,
Sean

----------------------------------------------------------
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]

Reply via email to