My understanding is that it's intentional - and a documented change from CF5. CFMX now automatically creates (and types) your variable based on first usage - previously myStruct.1 would be a single variable name containing a '.' whereas in CFMX that auto-creates myStruct and then assigns a value to the key "1".
On Friday, Nov 1, 2002, at 10:21 US/Pacific, Chris Kief wrote: > When creating an array or structure, CF allows things like this: > > <cfset myArray[1] = "foo" /> > <cfset myStruct.1 = "foo" /> > > But if the variable has been previously set to a different data type > (string in this case) like so: > > <cfset myArray = "foo" /> > <cfset myStruct = "foo" /> > > <cfset myArray[1] = "foo" /> > <cfset myStruct.1 = "foo" /> > > the following error is received: > > You have attempted to dereference a scalar variable of type class > java.lang.String as a structure with members. > > > You must specifically declare the variable as the new data type to > prevent errors: > > <cfset myArray = "foo" /> > <cfset myStruct = "foo" /> > > <cfset myArray = arrayNew(1) /> > <cfset myStruct = structNew() /> > > <cfset myArray[1] = "foo" /> > <cfset myStruct.1 = "foo" /> > > Was this a problem in CF5? Is this an expected behavior or a bug in > CFMX? It should be mentioned that going the opposite direction works > just fine: > > <cfset myArray[1] = "foo" /> > <cfset myStruct.1 = "foo" /> > > <cfset myArray = "foo" /> > <cfset myStruct = "foo" /> > > Your thoughts... > > chris kief > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm

