There is no inconsistency (or very little: none of what you cite are inconsistencies), it's just you not understanding the rules (which are pretty basic really). It's all in the docs: "Using number signs"
In short, within a CFML statement, all elements are considered CFML, so there is no need to specifically mark them as such. EG:
<cfset myVar = someFunction(anArgument)>
There is no ambiguity there that myVar
, someFunction
and anArgument
are anything other than CFML constructs, so no need to do this sort of thing:
<cfset myVar = #someFunction(anArgument)#>
As some people are inclined to do.
In the middle of text or within a string, there is ambiguity as to what's text and what's CFML, so one needs to use pound signs to mark them as such. EG:
<cfset myVar = "The time is #now()#">
It's necessary to us pound-signs there to disambiguate now()
as being a CFML statement, an not just part of the string, eg:
<cfset myVar = "CFML has a function now() which returns the current timestamp">
Equally:
<cfquery>
SELECT col1
FROM table2
WHERE col2 = #someValue#
</cfquery>
There would be no way of knowing someValue
is a variable there without marking it as such.
That's basically it. It's not complicated.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…