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

ok, that makes some sense

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

Yup, but that still means that the lookup is being done.

Does it really matter whether it's done by the structKeyExists() function or
the CF engine?

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

ok, but like I said above, the lookup is still being done. Does CF know not
to go as far as looking for the CGI variables?

As far as I can tell it will just keep looking for the structure in all the
scopes including the CGI scope.

>
>> 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().

That's an implementation detail that definitely shouldn't be documented.

The difference behaviour between how isDefined() and structKeyExists()
behave probably should.

Spike
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to