I'm with Joe on this one.

I, by convention and by adherence to MM "best practice dogma", use
scope.var for any non-local variable and simply varName for any local
variable. I believe that this, by definition, is the "best practice"
as expressed by Macromedia. I like the implicity because it leaves
things clear, concise, and uncluttered... yet very clear.

I suppose, if we were to be getting really strident about it, we
should petition Macromedia to *require* scoping for any non-local
variable. I think that using the $ or the _ to denote a local variable
is just... extra stuff hanging off my variable's names and makes them
look like C or C++ or VB or even old BASIC variables. Since I'm not
writing in those languages, why try to make my code look like them?
Why invent a new paradigm when there's already a perfectly good
"standard" toward which we should motivate people?

All of that to say this: I personally don't think it makes a lot of
sense to do what you're proposing and distract people from the actual
significance of what the code means and how to write it based on best
practices as defined by the MM documentation.

I also think it would help if we quit making it quite so public that
scoping isn't necessary. It's like writing tutorials that use session
variables without the cflock wrapper... it leaves the impression that
cflock isn't necesssary. It oughtn't be done.

Laterz,
J

-- 
Continuum Media Group LLC
Burnsville, MN 55337
http://www.web-relevant.com


On Thu, 23 Dec 2004 18:35:08 -0800, Joe Rinehart <[EMAIL PROTECTED]> wrote:
> Hey Michael,
> 
> I wouldn't use a prefix - instead, I recognize a variable as being
> local to a function by its lack of a scope, explicity stating the
> scope of variables in the arguments or variables scopes. Also,
> addressing arguments as "arguments.name" should be a touch of a
> performance boost as CF doesn't have to look into the 'local' scope to
> find your variable, realize it isn't there, then look at arguments.
> 
> -joe
> 
> On Thu, 23 Dec 2004 14:54:34 -0500, Michael Dinowitz
> <[EMAIL PROTECTED]> wrote:
> > I've started to use a dollar sign as a prefix for variables which are local
> > to a function or CFC. i.e. those variables created when using the var
> > keyword.
> > <CFSET var $Localvar="">
> > I could have also used an underscore like so:
> > <CFSET var _Localvar="">
> > I plan to give out the new CFCs and functions I'm writing (the logger is in
> > use and is being tweaked as we speak) and was wondering which you, the
> > ColdFusion using world, would prefer. I like the dollar sign, but I'm
> > willing to listen to what people have to say.
> >
> > As an aside, can someone using Blue Dragon please test to see if the dollar
> > sign and underscore are legal for variables on that platform? Thanks

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Silver Sponsor - New Atlanta
http://www.newatlanta.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:188731
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to