When setting the default value dynamically using a function call you may
want it to pickup any changes in that value rather than set it once and
never update it.
So if it worked in the opposite way it would still be a problem for someone
so not sure you can call it a bug.
Just wrap it in a structKeyExists, isdefined is legacy and checks every
scope.

Russ Michaels
www.michaels.me.uk
cfmldeveloper.com
cflive.net
cfsearch.com
On 14 Oct 2013 10:19, "Byron Mann" <[email protected]> wrote:

>
> I'm wondering if this is some sort of flaw or maybe a known issue, it looks
> like cfparam evaluates the default value every time.
>
> <cfset x = createObject('component', 'CFIDE.adminapi.runtime')>
> <cftimer label="t1" type="debug">
>     <cfloop from="1" to="1000" index="c">
>         <cfparam name="server.vals.com.lnh.system.GetInstanceNameTest"
> default="#x.getInstanceName()#">
>     </cfloop>
> </cftimer>
> <cftimer label="t2" type="debug">
>     <cfloop from="1" to="1000" index="c">
>         <cfparam name="server.vals.com.lnh.system.GetInstanceNameTest"
> default="#x#">
>     </cfloop>
> </cftimer>
>
> The first look takes significantly longer.  I tried different variations,
> like wrapping in toString(), etc, with no changes in behavior.
>
> A more simplified example results the same type of behavior.
>
> <cfset x = 1>
> <cftimer label="t0" type="debug">
>     <cfloop from="1" to="500000" index="c">
>         <cfparam name="server.vals.com.lnh.system.GetInstanceNameTest"
> default="#x#">
>     </cfloop>
> </cftimer>
> <cftimer label="t0" type="debug">
>     <cfloop from="1" to="500000" index="c">
>         <cfparam name="server.vals.com.lnh.system.GetInstanceNameTest"
> default="1">
>     </cfloop>
> </cftimer>
>
> To me this kind of defeats the purpose as it should really act like
> isDefined.  I guess this has something to do with how templates are
> compiled.
>
> Byron Mann
> Lead Engineer & Architect
> HostMySite.com
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356917
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to