For what it is worth after a bit of googling, most resources list variables
as the first scope and exclude arguments altogether. However I did confirm
that arguments is searched first with this quick test:
<cffunction name="outputBlah">
<cfargument name="Blah">
<cfoutput>#Blah#</cfoutput>
</cffunction>
<cfset Blah = "variables">
<cfset outputBlah("arguments") />
When I run that code, the string "arguments" appears on the page.
~d
On 6/29/07, Dave Shuck <[EMAIL PROTECTED]> wrote:
Sophek , I just double checked and my frail memory was failing me it
appears. I didn't remember (if I ever knew!) that arguments was searched
first.
Here is the order of precedence:
1. Arguments
2. Variables
3. CGI
4. Cffile
5. URL
6. Form
7. Cookie
8. Client
On 6/29/07, Sophek Tounn < [EMAIL PROTECTED]> wrote:
>
> Thanks guys,
>
> Dave I didn't know that it looks in the variables scope first, i thought
> it was alphabetical.
>
> Thanks
> Sophek
>
> On 6/29/07, Dave Shuck <[EMAIL PROTECTED]> wrote:
> >
> > There is an argument that by explicitly scoping variables, CF doesn't
> > have to work as hard by traversing through scopes to find the first one.
> > However, since it looks in the variables scope first that wouldn't apply in
> > this case. I agree with Mike though - I would probably do this:
> >
> > <cfif left(arguments.dataString,3) EQ "No:">
> >
> > ... unless you are planning on using it later.
> >
> > On 6/29/07, Mike Kelp <[EMAIL PROTECTED]> wrote:
> > >
> > > The only thing you would save is the variable creation itself by
> > > putting it into your if statement (hardly anything to worry about).
> > >
> > > If you think that is more readable, i would say yes.
> > >
> > > Mike.
> > >
> > >
> > > Sophek Tounn wrote:
> > >
> > > Hi All,
> > >
> > > Would you declare this as a best practice?
> > >
> > > <cfset variables.leftside = left(arguments.dataString,3)>
> > > <cfset variables.rightside = right(arguments.dataString,3)>
> > >
> > >
> > > <cfif variables.leftside EQ "No:">
> > >
> > > </cfif>
> > >
> > > Is there an performance gain by putting the variables. in my if
> > > statement?
> > >
> > > Thanks
> > > Sophek
> > >
> > > ------------------------------
> > >
> > > _______________________________________________
> > > Reply to DFWCFUG:
> > > [email protected]
> > > Subscribe/Unsubscribe:
> > > http://lists1.safesecureweb.com/mailman/listinfo/list
> > > List Archives:
> > > http://www.mail-archive.com/list%40list.dfwcfug.org/
> > >
> > >
> > >
> > > http://www.mail-archive.com/list%40dfwcfug.org/
> > > DFWCFUG Sponsors:
> > > www.instantspot.com/
> > > www.teksystems.com/
> > >
> > >
> > > _______________________________________________
> > > Reply to DFWCFUG:
> > > [email protected]
> > > Subscribe/Unsubscribe:
> > > http://lists1.safesecureweb.com/mailman/listinfo/list
> > > List Archives:
> > > http://www.mail-archive.com/list%40list.dfwcfug.org/
> > > http://www.mail-archive.com/list%40dfwcfug.org/
> > > DFWCFUG Sponsors:
> > > www.instantspot.com/
> > > www.teksystems.com/
> > >
> > >
> >
> >
> > --
> > ~Dave Shuck
> > [EMAIL PROTECTED]
> > http://daveshuck.instantspot.com
> > _______________________________________________
> > Reply to DFWCFUG:
> > [email protected]
> > Subscribe/Unsubscribe:
> > http://lists1.safesecureweb.com/mailman/listinfo/list
> > List Archives:
> > http://www.mail-archive.com/list%40list.dfwcfug.org/
> > http://www.mail-archive.com/list%40dfwcfug.org/
> > DFWCFUG Sponsors:
> > www.instantspot.com/
> > www.teksystems.com/
> >
> >
>
> _______________________________________________
> Reply to DFWCFUG:
> [email protected]
> Subscribe/Unsubscribe:
> http://lists1.safesecureweb.com/mailman/listinfo/list
> List Archives:
> http://www.mail-archive.com/list%40list.dfwcfug.org/
> http://www.mail-archive.com/list%40dfwcfug.org/
> DFWCFUG Sponsors:
> www.instantspot.com/
> www.teksystems.com/
>
>
--
~Dave Shuck
[EMAIL PROTECTED]
http://daveshuck.instantspot.com
--
~Dave Shuck
[EMAIL PROTECTED]
http://daveshuck.instantspot.com
_______________________________________________
Reply to DFWCFUG:
[email protected]
Subscribe/Unsubscribe:
http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
http://www.mail-archive.com/list%40list.dfwcfug.org/
http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
www.instantspot.com/
www.teksystems.com/