On Thursday, Apr 3, 2003, at 04:51 US/Pacific, Howard Fore wrote:
The deciding factor seems to be whether or not you have a default value set for the CFARGUMENT.

Not true. And your own code proves that.


        <cfargument name="arg1" type="string">
        <cfargument name="arg2" type="string">
        <cfargument name="arg3" type="string" default="Ni!">

And, exactly as I said:


This yields:
ARG1EXISTS                      YES
ARG2EXISTS                      NO

structKeyExists() correctly returns false for this (even tho' it *is* in the struct - with an undefined value).


ARG3EXISTS YES

structKeyExists() correctly returns true here because there *is* a value for arg3: you supplied it in your default.


ARGUMENTS                       struct
                                        ARG1            MR2DX
                                        ARG2            [undefined struct element]
                                        ARG3            Ni!

As you can see, it isn't the mere existence of the CFARGUMENT that adds it to the arguments struct, it is the assignation of a default value.

No, you're missing the point. Your original post commented on the [undefined struct element] issue because arrayLen() and structCount() on arguments did not produce expected values. That's purely to do with the mere presence of the cfargument tag.


The default value is separate - if you specify a default then that argument will *always* exist and will either have the default value you specify or the value of the passed-in argument.

The workaround here is to not use the default attribute unless you want to set a non-empty value.

That's exactly what default= is for.


However it seems to me that the current behavior is messy. A function parameter that is empty is vastly different from one that is undefined altogether (null != empty).

Of course, and isDefined() and structKeyExists() both let you test for that.


Again, if you specify default= then your argument will *always* be present - that's what default= means.

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email.


CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

Reply via email to