cfvonner
10/20/2022, 4:05 PMAdam Cameron
Adam Cameron
Adam Cameron
mtbrown
10/20/2022, 4:25 PMstatic
is considered a scope. Although it seems to work fine for ColdFusion in Adam's example, but that could just be because it's not within a component which I believe is the only place where that scope would be applicable.cfvonner
10/20/2022, 4:25 PMAdam Cameron
writeOutput
Code:
<!--- test.cfm --->
<cfscript>
static = "no reason for it to be a reserved word, no"
writeOutput(static)
</cfscript>
// C.cfc
component {
function f() {
static = "no reason for it to be a reserved word, no" // Lucee just ignores this (bug) // CF won't compile this
writeOutput(static) // and doesn't like this cos static is a complex object
}
}
<!--- testC.cfm --->
<cfset o = new C()>
<cfset o.f()>
Adam Cameron
Reserved for static context.
hrmmtbrown
10/20/2022, 4:35 PMvar
scope it?mtbrown
10/20/2022, 4:41 PMzackster
10/20/2022, 5:13 PMAdam Cameron
var static = "no reason for it to be a reserved word, no"
, then CF handles it fine. Lucee still ignores it.
I worked out what Lucee is doing. In my method static = "no reason for it to be a reserved word, no"
is being treated as an assignment of local.static
(I have modern
scope mode switched on on this instance). Fair cop. I would also expect a bare static
reference (as per the following line) to be considered a reference to the static scope... other than that is not correct CFML behaviour as per the CF example. So even if Lucee is doing it on purpose, it's still a bug.zackster
10/20/2022, 5:37 PM