>
> Patrick -
> The problem with not using any scope is that if you have a local variable
> with the name "myvar" as well as a one in the form scope, things get
> overwritten. Therefore, it's a good idea to prefix any variable with it's
> scope, not just leave CF to do it's ordering thing.
>
> NAT

Nat,

Please forgive my original post. I kind of rambled, and actually changed
my mind in the middle of writing it, so I'm sure it didn't make much sense.
Let me start over.

There are no such things as variables without a scope in Cold Fusion. Those
variables are actually part of the little known VARIABLES scope. Try
this.

<cfset aVar = "I am a variable!">
<cfoutput>#variables.aVar#</cfoutput>

What I'm saying is we don't need to use ATTRIBUTES as our local scope
in Cold Fusion, because we already have a default local scope. If we
modified CF_FormURL2Attributes so that it copies everything to the
VARIABLES scope, rather than the ATTRIBUTES scope, we can leave off the
scope prefix when referring to variables.

If you're worried about namespace collisions as you described, we can
prefix our local (supposedly scopeless) variables with "variables."
and avoid that problem. Or, if you're not worried about namespace
collisions (and I'm not in most cases), you can leave off the scope
prefix.

And for those of you who are sticklers about doing everything "properly,"
this *is* the proper way, whereas the ATTRIBUTES way isn't. ATTRIBUTES isn't
really a local scope. It's just how information gets passed to a custom
tag. I consider the fact that it's even writeable a bug. Cold Fusion has a
local scope built in, and that scope is VARIABLES.

Because I'm not proposing that we throw out CF_FormURL2Attributes, there's
no need to worry about search engine friendly URL's, etc., either.

As far as I can see, this solution should make everyone happy, except
those who are worried about the overhead of CF_FormURL2Attributes. <Must..
resist... urge... to... moan at people... who... think... Fusebox... or...
Cold Fusion for that matter... is... geared towards... processing
efficiency!>

Patrick


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to