Is there ever a good reason to use IsDefined rather than
StruckKeyExists?
_____
From: Sean Corfield [mailto:[EMAIL PROTECTED]
Sent: Monday, July 12, 2004 5:32 PM
To: CF-Talk
Subject: Re: StructKeyExists() vs IsDefined()
> It looks from that like structKeyExists() will check if the structure
is the
> name of a scope and not bother to check if it is the name of a
structure in
> one of the implicit scopes.
I think you're misunderstanding what's been said: CF itself does the
lookup on the first argument to structKeyExists() - whatever it finds,
in whatever scope it finds it, is what is passed to structKeyExists()
to look at.
> <cfset variables.foo = structNew()>
> <cfset variables.foo.test = "bar">
> <cfoutput>#structKeyExists(foo,'test')#</cfoutput>
> returns "YES", while this:
CF looks up foo and finds it in variables scope and passes the
'contents' of foo to structKeyExists(). structKeyExists() looks inside
that and finds the key test.
> <cfset variables.form = structNew()>
> <cfset variables.form.test = "bar">
> <cfoutput>#structKeyExists(form,'test')#</cfoutput>
> returns "NO"
Right. CF looks up form and finds the form scope and then passes the
'contents' of that to structKeyExists(). structKeyExists() looks
inside that and does not find bar.
> There is nothing in the documentation to support that this should be
the
> case.
Sure there is but it's all about variable lookup in scopes and nothing
to do with structKeyExists().
_____
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
[Donations and Support]
- Re: StructKeyExists() vs IsDefin... Sean Corfield
- Re: StructKeyExists() vs IsDefin... Sean Corfield
- Re: StructKeyExists() vs IsDefin... Sean Corfield
- RE: StructKeyExists() vs IsDefin... Spike
- Re: StructKeyExists() vs IsDefin... Sean Corfield
- Re: StructKeyExists() vs IsDefined() Matt Robertson
- Adding to dates using CreateTimeSpan() Jordan Michaels
- Re: Adding to dates using CreateTimeSpan(... Bruce Sorge
- Re: Adding to dates using CreateTime... Jordan Michaels
- Re: StructKeyExists() vs IsDefined() Jordan Michaels
- RE: StructKeyExists() vs IsDefined() Dawson, Michael
- RE: StructKeyExists() vs IsDefined() Barney Boisvert
- RE: StructKeyExists() vs IsDefined() Spike
- RE: StructKeyExists() vs IsDefined() Hugo Ahlenius
- Re: StructKeyExists() vs IsDefined() Mike Chabot