Hi All, Just to follow up on this - now that I am back to working on this issue... And, not that I ever doubted Charlie... but a some working code is worth a thousand words... <cffunction name="blah"> <cfargument name="messageid" required="false" /> <cfargument name="text" required="false" /> <cfargument name="queryid" required="false" /> <cfargument name="datasource" required="false" />
<cfset var local = {} > <cfset local.mystruct.1 = arrayIsDefined(arguments, 1)> <cfset local.mystruct.2 = arrayIsDefined(arguments, 2)> <cfset local.mystruct.3 = arrayIsDefined(arguments, 3)> <cfset local.mystruct.4 = arrayIsDefined(arguments, 4)> <cfreturn local.mystruct> </cffunction><cfset myStruct = blah(text="gav", queryid=3)> <cfdump var="#myStruct#"> Gives the following; struct 1 NO 2 YES 3 YES 4 NO Which will solve the issue I am having, thanks Charlie. Though I still think the implementation should be consistent across all functions. Gavin. On Saturday, January 7, 2012 2:51:51 AM UTC+11, charlie arehart wrote: > I’ll repeat, in case the point was missed: if the concern here is that > structkeyexists doesn’t do the job, note again that the arguments struct > can be treated as an array as well as a struct. And the arrayisdefined > function (new since 8) can test for the existence (or not) of an element in > the array—and there will be no element in the array for an argument which > was defined with cfargument but not passed in on the call (which was the > concern originally presented). Hope that helps someone. > > /charlie > > > > *From:* cfau...@googlegroups.com [mailto:cfau...@googlegroups.com] *On > Behalf Of *Dennis Clark > *Sent:* Friday, January 06, 2012 2:51 AM > *To:* cfau...@googlegroups.com > *Subject:* Re: [cfaussie] Count the number of arguments passed into a > function. > > > > Unfortunately it's too late to strive for consistency at this point. > > > > The odd behaviour of structKeyExists is due to the underlying Java > implementation, the inconsistent handling of null values in Adobe CFML, and > backwards compatibility concerns. > > > > CF structs are special Java objects that implement the java.util.Map > interface. The method to retrieve a value in a Map is get(key). > Map.get(key) returns a Java null if the key does not exist in the map. > However if the <snip> > -- You received this message because you are subscribed to the Google Groups "cfaussie" group. To view this discussion on the web visit https://groups.google.com/d/msg/cfaussie/-/yyMurNUvkXwJ. To post to this group, send email to cfaussie@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en.