It is the sort of thing you don't want to teach your developers as I can
imagine the heartache that would cause.

On 06/06/07, David Harris <[EMAIL PROTECTED]> wrote:
>
>
> you can do this (as per my example code):
> <cfset myStruct["some value here"] = "bob">
>
> try this one:
>
> <cfset myStruct = structNew()>
> <cfset myStruct["some.value.here and a space too, and an
> [EMAIL PROTECTED]"] = "fred">
> <cfdump var="#myStruct#">
>
>
> it's one of those things that *can* be done, but (as rule of thumb)
> isn't...
>
> but if you do, It'll break "isDefined()"
>
>
>
> MrBuzzy wrote:
> > Um where the code 'breaks' in your example. This isn't valid struct
> usage.
> > Just the same as you can't do this...
> >
> > <cfset myStruct.some value here = "nonono">
> >
> > Or did I miss something? Ie; this would 'break' it too...
> >
> > IsDefined(" ! ")
> >
> > Cheers.
> >
> > On 6/5/07, David Harris <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > > and if you get a bit carried away with struct key names, you can break
> > > it too...
> > >
> > > EG:
> > >
> > > <cfset myStruct = structNew()>
> > >
> > > <cfset myStruct["some value here"] = "bob">
> > >
> > > <cfdump var="#myStruct#">
> > >
> > > <cfoutput>#isDefined(" myStruct.some value here")#</cfoutput> <!---
> > > this line breaks --->
> > >
> > > <cfoutput>#structKeyExists(myStruct, "some value here")#</cfoutput>
> > > <!--- this line works --->
> > >
> > > On Jun 5, 9:46 pm, David Harris <[EMAIL PROTECTED]> wrote:
> > > > One place to NOT use isDefined is on the CGI scope...
> > > >
> > > > try this:
> > > >
> > > > <cfoutput>
> > > > <p>
> > > > isDefined("cgi.bob") = #isDefined("cgi.bob")#
> > > > </p>
> > > > <p>
> > > > structKeyExists(cgi, "bob") = #structKeyExists(cgi,"bob")#
> > > > </p>
> > > > </cfoutput>
> > > >
> > > > >From what I remeber, the CGI is a "magic" scope...
> > > >
> > > > <quote from docs>
> > > > Because some browsers do not support some CGI variables, ColdFusion
> > > > always returns True when it tests for the existence of a CGI
> variable,
> > > > regardless of whether the browser supports the variable.
> > > > </quote from docs>
> > >
> > >
> > > >
> > >
>
>
> >
>


-- 
Cheers
Simon Haddon

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