I'm wondering if this is expected behaviour.. shou...
# lucee
c
I'm wondering if this is expected behaviour.. should the static
shout
method have access to the variables scoped
excl
in the calling index.cfm template? Is the
variables
scope considered static? (Lucee has an actual
static
scope)
Copy code
// Shouter.cfc
component {
	public static string function shout(v) {
		return UCase(arguments.v) & variables.excl; // should 
	}
}

// index.cfm
<cfscript>
variables.excl = "!";
shouts = ["twist", "shout"].map(Shouter::shout);
dump(shouts);
</cfscript>
Lucee 5.4
🤯 1
b
I would not expect a static method invocation to be able to "see" the variables scope from outside the CFC its being called on.
That said, it's hard to say if this is happening on purpose or on accident.
I'm curious what Adobe does here
I'm 99% BoxLang would not allow that variable to be seen. In fact, it would probably yell at you that the
variables
scope is not accessible in a static method if I were to guess.
c
I would agree variables scope should not be accessible,