I reverse the issue - instead of a "don't" I use an "only" - as in "only use
hashes to specify a variable/_expression_ in a string."

That's really the only time you need it (remembering that CFOUTPUT really
encloses a string as well).  So the following is legal but not "good":

<cfif #foo#></cfif>

<cfset foo = #x# + #y# />

The following is "good":

<cfif foo></cfif>

<cfset foo = x + y />

Now in my tag-based, html-influenced way of writing I tend to also quote all
attributes so that adds a slightly new dimension to the argument.  For
example I generally do this:

<cfloop from="1" to="#x#" index="Cnt"></cfloop>

It still meets my definition (I'm hashing "x" to specify the variable within
a string).  However other might are argue that the following is "good":

<cfloop from=1 to=x index="Cnt"></cfloop>

As for performance I don't think there's any performance difference in any
version - and if there were in previous versions I would say with blind
confidence that there isn't in MX.

It's purely a stylistic issue as far as I can see, important to people, not
the machine.  No different (but no less important to some) than indenting
"properly", for example.

Jim Davis

From: Steve Brownlee [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 15, 2004 8:38 AM
To: CF-Talk
Subject: Basics Clarification

We've all said it a million times - don't use the hashes inside a CF tag
that
processes on its own.

<!--- No no no --->
<cfif #check# eq "1">

But one thing I've always wondered is why.  I know doing this is wrong from
years of seeing people scream at developers who do it, but I never heard an
explanation as to what problems this causes.  Anyone know the guts behind
this?
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to