On Saturday, August 17, 2002, at 06:40 , Raymond Camden wrote:
> What is wrong with using the default? Yes, if you need more complex
> initialization, you would use isDefined, but if you just want to init
> the value to a blank array, the default is a valid way to do so.
Yes, if default="#arrayNew(1)#" makes sense, that's fine. The original
question was why default="" did not work - because "" is not a valid array
default!
If your function does this sort of thing, then the empty array default is
reasonable:
<cfset numVals = arrayLen(arguments.vals)/>
<cfloop index="i" from="1" to="#numVals#">
...
</cfloop>
i.e., where the function's normal processing accepts an empty array and it
doesn't care whether the user supplied 'vals' or not.
However, if the *presence* of the argument causes different behavior, no
default is going to let you detect that - you have to use 'isDefined()'.
Sean A Corfield -- http://www.corfield.org/blog/
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood
______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists